Class: VORuby::VOTable::V1_1::Tr
- Inherits:
-
Base
- Object
- XML::Object::Base
- Base
- VORuby::VOTable::V1_1::Tr
- Defined in:
- lib/voruby/votable/1.1/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.
1990 1991 1992 |
# File 'lib/voruby/votable/1.1/votable.rb', line 1990 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(), ...]
1996 1997 1998 |
# File 'lib/voruby/votable/1.1/votable.rb', line 1996 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>
2007 2008 2009 2010 2011 2012 2013 2014 2015 |
# File 'lib/voruby/votable/1.1/votable.rb', line 2007 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 |