Class: Mathemagical::Table

Inherits:
Element
  • Object
show all
Defined in:
lib/mathemagical/element.rb

Instance Attribute Summary

Attributes inherited from Element

#attributes, #children, #display_style, #name

Instance Method Summary collapse

Methods inherited from Element

#<<, #[], #[]=, #as_display_style, #build_attributes_string, #child_ml, #pop, #self_closing_xml, #to_s, #xml

Constructor Details

#initializeTable

Returns a new instance of Table.



260
261
262
# File 'lib/mathemagical/element.rb', line 260

def initialize
	super("mtable")
end

Instance Method Details

#aligns=(a) ⇒ Object



280
281
282
# File 'lib/mathemagical/element.rb', line 280

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

#hlines=(a) ⇒ Object



288
289
290
# File 'lib/mathemagical/element.rb', line 288

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

#set_align_attribute(name, a, default) ⇒ Object



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/mathemagical/element.rb', line 264

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



284
285
286
# File 'lib/mathemagical/element.rb', line 284

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