class MathML::SubSup

Attributes

body[R]
sub[R]
sup[R]

Public Class Methods

new(display_style, body) click to toggle source
Calls superclass method
   # File lib/math_ml/element.rb
87 def initialize(display_style, body)
88   super('mrow')
89   as_display_style if display_style
90   @body = body
91 end

Public Instance Methods

sub=(sub) click to toggle source
    # File lib/math_ml/element.rb
127 def sub=(sub)
128   @sub = sub
129   update
130 end
sup=(sup) click to toggle source
    # File lib/math_ml/element.rb
132 def sup=(sup)
133   @sup = sup
134   update
135 end

Private Instance Methods

update() click to toggle source
    # File lib/math_ml/element.rb
121 def update
122   update_name
123   update_contents
124 end
update_contents() click to toggle source
    # File lib/math_ml/element.rb
113 def update_contents
114   contents.clear
115   contents << @body
116   contents << @sub if @sub
117   contents << @sup if @sup
118 end
update_name() click to toggle source
    # File lib/math_ml/element.rb
 93 def update_name
 94   if @sub || @sup
 95     name = 'm'
 96     name << (if @sub
 97                @display_style ? 'under' : 'sub'
 98              else
 99                ''
100              end)
101     name << (if @sup
102                @display_style ? 'over' : 'sup'
103              else
104                ''
105              end)
106   else
107     name = 'mrow'
108   end
109   self.name = name
110 end