Class: VORuby::VOTable::V1_0::Tr
- Inherits:
-
Base
- Object
- XML::Object::Base
- Base
- VORuby::VOTable::V1_0::Tr
- Defined in:
- lib/voruby/votable/1.0/votable.rb
Overview
A row of data in a TableData.
Constant Summary collapse
- ELEMENT_NAME =
'TR'
Instance Attribute Summary
Attributes inherited from XML::Object::Base
Instance Method Summary collapse
-
#initialize(defn = nil) ⇒ Tr
constructor
Create a new row of data.
-
#tds ⇒ Object
Retrieve the table data elements in the row.
-
#tds=(columns) ⇒ Object
Set the data elements of the row.
-
#to_html ⇒ Object
Convert a table row to HTML.
Methods inherited from Base
#==, element_name, #get_element, #xpath_for
Methods inherited from XML::Object::Base
#==, element_name, from_file, #to_s
Constructor Details
Instance Method Details
#tds ⇒ Object
Retrieve the table data elements in the row. Returns a HomogeneousNodeList.
1699 1700 1701 |
# File 'lib/voruby/votable/1.0/votable.rb', line 1699 def tds HomogeneousNodeList.new(self.node, xpath_for(Td), Td) end |
#tds=(columns) ⇒ Object
Set the data elements of the row.
tr.tds = [Td.new(), ...]
1705 1706 1707 |
# File 'lib/voruby/votable/1.0/votable.rb', line 1705 def tds=(columns) self.tds.replace(columns) end |
#to_html ⇒ Object
Convert a table row to HTML.
tr = Tr.new(:tds => [Td.new(:text => 'hello'), Td.new(:text => 'world')])
puts tr.to_html # =>
<tr>
<td>hello</td>
<td>world</td>
</tr>
1716 1717 1718 1719 1720 1721 1722 1723 1724 |
# File 'lib/voruby/votable/1.0/votable.rb', line 1716 def to_html builder = Builder::XmlMarkup.new(:indent => 2, :margin => 4) builder.tr { |tr| self.tds.each do |column| tr << column.to_html end } end |