Class: MathML::Table

Inherits:
Element show all
Defined in:
lib/math_ml/element.rb

Instance Attribute Summary

Attributes inherited from Element

#display_style

Instance Method Summary collapse

Methods inherited from Element

#as_display_style

Methods inherited from XMLElement

#pop

Constructor Details

#initializeTable

Returns a new instance of Table.


183
184
185
# File 'lib/math_ml/element.rb', line 183

def initialize
  super("mtable")
end

Instance Method Details

#aligns=(a) ⇒ Object


203
204
205
# File 'lib/math_ml/element.rb', line 203

def aligns=(a)
  set_align_attribute("columnalign", a, Align::CENTER)
end

#hlines=(a) ⇒ Object


211
212
213
# File 'lib/math_ml/element.rb', line 211

def hlines=(a)
  set_align_attribute("rowlines", a, Line::NONE)
end

#set_align_attribute(name, a, default) ⇒ Object


187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/math_ml/element.rb', line 187

def set_align_attribute(name, a, default)
  if a.is_a?(Array) && a.size>0
    value = ""
    a.each do |i|
      value << " "+i
    end
    if value =~ /^( #{default})*$/
      @attributes.delete(name)
    else
      @attributes[name] = value.strip
    end
  else
    @attributes.delete(name)
  end
end

#vlines=(a) ⇒ Object


207
208
209
# File 'lib/math_ml/element.rb', line 207

def vlines=(a)
  set_align_attribute("columnlines", a, Line::NONE)
end