Class: Swordfish::Node::TableCell
- Defined in:
- lib/swordfish/nodes/table_cell.rb
Instance Attribute Summary collapse
-
#colspan ⇒ Object
readonly
Returns the value of attribute colspan.
-
#merge_left ⇒ Object
Returns the value of attribute merge_left.
-
#merge_up ⇒ Object
Returns the value of attribute merge_up.
-
#rowspan ⇒ Object
readonly
Returns the value of attribute rowspan.
Attributes inherited from Base
Instance Method Summary collapse
-
#merge_left? ⇒ Boolean
True if this cell is merged with the one to the left.
-
#merge_up? ⇒ Boolean
True if this cell is merged with the one above.
- #to_html ⇒ Object
Methods inherited from Base
#append, #clear_children, #find_nodes_by_type, #inform!, #initialize, #replace, #replace_with, #stylize, #wrap_children
Constructor Details
This class inherits a constructor from Swordfish::Node::Base
Instance Attribute Details
#colspan ⇒ Object (readonly)
Returns the value of attribute colspan.
10 11 12 |
# File 'lib/swordfish/nodes/table_cell.rb', line 10 def colspan @colspan end |
#merge_left ⇒ Object
Returns the value of attribute merge_left.
7 8 9 |
# File 'lib/swordfish/nodes/table_cell.rb', line 7 def merge_left @merge_left end |
#merge_up ⇒ Object
Returns the value of attribute merge_up.
8 9 10 |
# File 'lib/swordfish/nodes/table_cell.rb', line 8 def merge_up @merge_up end |
#rowspan ⇒ Object (readonly)
Returns the value of attribute rowspan.
9 10 11 |
# File 'lib/swordfish/nodes/table_cell.rb', line 9 def rowspan @rowspan end |
Instance Method Details
#merge_left? ⇒ Boolean
True if this cell is merged with the one to the left
13 14 15 |
# File 'lib/swordfish/nodes/table_cell.rb', line 13 def merge_left? !!@merge_left end |
#merge_up? ⇒ Boolean
True if this cell is merged with the one above
18 19 20 |
# File 'lib/swordfish/nodes/table_cell.rb', line 18 def merge_up? !!@merge_up end |
#to_html ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/swordfish/nodes/table_cell.rb', line 22 def to_html return nil if @colspan == 0 && @rowspan == 0 if @rowspan && @rowspan > 1 rowspan = " rowspan=#{@rowspan}" end if @colspan && @colspan > 1 colspan = " colspan=#{@colspan}" end "<td#{rowspan}#{colspan}>#{@children.map(&:to_html).join}</td>" end |