Class: Arrolio::Content::Table::Cell
- Inherits:
-
Object
- Object
- Arrolio::Content::Table::Cell
- Defined in:
- lib/arrolio/content/table.rb
Instance Attribute Summary collapse
-
#align ⇒ Object
readonly
Returns the value of attribute align.
-
#colspan ⇒ Object
readonly
Returns the value of attribute colspan.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#rowspan ⇒ Object
readonly
Returns the value of attribute rowspan.
-
#style_id ⇒ Object
readonly
Returns the value of attribute style_id.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(content = [], colspan: 1, rowspan: 1, style_id: :table_cell, align: nil) ⇒ Cell
constructor
A new instance of Cell.
- #text ⇒ Object
Constructor Details
#initialize(content = [], colspan: 1, rowspan: 1, style_id: :table_cell, align: nil) ⇒ Cell
Returns a new instance of Cell.
85 86 87 88 89 90 91 92 93 |
# File 'lib/arrolio/content/table.rb', line 85 def initialize(content = [], colspan: 1, rowspan: 1, style_id: :table_cell, align: nil) @content = Array(content).freeze @colspan = colspan.to_i @rowspan = rowspan.to_i @style_id = style_id.to_sym @align = align freeze end |
Instance Attribute Details
#align ⇒ Object (readonly)
Returns the value of attribute align.
83 84 85 |
# File 'lib/arrolio/content/table.rb', line 83 def align @align end |
#colspan ⇒ Object (readonly)
Returns the value of attribute colspan.
83 84 85 |
# File 'lib/arrolio/content/table.rb', line 83 def colspan @colspan end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
83 84 85 |
# File 'lib/arrolio/content/table.rb', line 83 def content @content end |
#rowspan ⇒ Object (readonly)
Returns the value of attribute rowspan.
83 84 85 |
# File 'lib/arrolio/content/table.rb', line 83 def rowspan @rowspan end |
#style_id ⇒ Object (readonly)
Returns the value of attribute style_id.
83 84 85 |
# File 'lib/arrolio/content/table.rb', line 83 def style_id @style_id end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
101 102 103 104 105 106 107 108 |
# File 'lib/arrolio/content/table.rb', line 101 def ==(other) other.is_a?(self.class) && content == other.content && colspan == other.colspan && rowspan == other.rowspan && style_id == other.style_id && align == other.align end |
#hash ⇒ Object
112 113 114 |
# File 'lib/arrolio/content/table.rb', line 112 def hash [self.class, content, colspan, rowspan, style_id, align].hash end |
#text ⇒ Object
95 96 97 98 99 |
# File 'lib/arrolio/content/table.rb', line 95 def text @content.map do |node| node.is_a?(Paragraph) ? node.text : node.to_s end.join(' ') end |