Class: RODF::Table

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

Instance Method Summary collapse

Methods inherited from Container

contains, create

Constructor Details

#initialize(title) ⇒ Table

Returns a new instance of Table.



28
29
30
31
# File 'lib/rodf/table.rb', line 28

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

Instance Method Details

#create_rowObject



33
# File 'lib/rodf/table.rb', line 33

alias create_row row

#row(options = {}, &contents) ⇒ Object



34
35
36
# File 'lib/rodf/table.rb', line 34

def row(options={}, &contents)
  create_row(next_row, options) {instance_eval(&contents) if block_given?}
end

#xmlObject



38
39
40
41
42
43
# File 'lib/rodf/table.rb', line 38

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