Class: ODF::Table

Inherits:
Container show all
Defined in:
lib/odf/table.rb

Instance Method Summary collapse

Methods inherited from Container

contains, create

Constructor Details

#initialize(title) ⇒ Table

Returns a new instance of Table.



29
30
31
32
# File 'lib/odf/table.rb', line 29

def initialize(title)
  @title = title
  @last_row = 0
end

Instance Method Details

#create_rowObject



34
# File 'lib/odf/table.rb', line 34

alias create_row row

#rowObject



35
36
37
# File 'lib/odf/table.rb', line 35

def row
  create_row(next_row) {|r| yield r if block_given?}
end

#xmlObject



39
40
41
42
43
44
# File 'lib/odf/table.rb', line 39

def xml
  Builder::XmlMarkup.new.table:table, 'table:name' => @title do |xml|
    xml << columns_xml
    xml << rows_xml
  end
end