Class: TableParser::TableNode
- Inherits:
-
Object
- Object
- TableParser::TableNode
- Defined in:
- lib/table_parser/table_node.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#colspan ⇒ Object
readonly
Returns the value of attribute colspan.
-
#element ⇒ Object
readonly
Returns the value of attribute element.
-
#rowspan ⇒ Object
readonly
Returns the value of attribute rowspan.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(element, rowspan = nil, colspan = nil) ⇒ TableNode
constructor
A new instance of TableNode.
- #span(row, col) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(element, rowspan = nil, colspan = nil) ⇒ TableNode
Returns a new instance of TableNode.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/table_parser/table_node.rb', line 4 def initialize(element, rowspan=nil, colspan=nil) @element = element @text = element.text.strip rescue "" if element.nil? @colspan = colspan || 1 @rowspan = rowspan || 1 else @colspan = colspan || element["colspan"].nil? ? 1 : element["colspan"].to_i @rowspan = rowspan || element["rowspan"].nil? ? 1 : element["rowspan"].to_i end end |
Instance Attribute Details
#colspan ⇒ Object (readonly)
Returns the value of attribute colspan.
3 4 5 |
# File 'lib/table_parser/table_node.rb', line 3 def colspan @colspan end |
#element ⇒ Object (readonly)
Returns the value of attribute element.
3 4 5 |
# File 'lib/table_parser/table_node.rb', line 3 def element @element end |
#rowspan ⇒ Object (readonly)
Returns the value of attribute rowspan.
3 4 5 |
# File 'lib/table_parser/table_node.rb', line 3 def rowspan @rowspan end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
3 4 5 |
# File 'lib/table_parser/table_node.rb', line 3 def text @text end |