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.
-
#valign ⇒ Object
readonly
Returns the value of attribute valign.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(content = [], colspan: 1, rowspan: 1, style_id: :table_cell, align: nil, valign: nil) ⇒ Cell
constructor
A new instance of Cell.
- #text ⇒ Object
Constructor Details
#initialize(content = [], colspan: 1, rowspan: 1, style_id: :table_cell, align: nil, valign: nil) ⇒ Cell
Returns a new instance of Cell.
94 95 96 97 98 99 100 101 102 103 |
# File 'lib/arrolio/content/table.rb', line 94 def initialize(content = [], colspan: 1, rowspan: 1, style_id: :table_cell, align: nil, valign: nil) @content = Array(content).freeze @colspan = colspan.to_i @rowspan = rowspan.to_i @style_id = style_id.to_sym @align = align&.to_sym @valign = valign&.to_sym freeze end |
Instance Attribute Details
#align ⇒ Object (readonly)
Returns the value of attribute align.
92 93 94 |
# File 'lib/arrolio/content/table.rb', line 92 def align @align end |
#colspan ⇒ Object (readonly)
Returns the value of attribute colspan.
92 93 94 |
# File 'lib/arrolio/content/table.rb', line 92 def colspan @colspan end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
92 93 94 |
# File 'lib/arrolio/content/table.rb', line 92 def content @content end |
#rowspan ⇒ Object (readonly)
Returns the value of attribute rowspan.
92 93 94 |
# File 'lib/arrolio/content/table.rb', line 92 def rowspan @rowspan end |
#style_id ⇒ Object (readonly)
Returns the value of attribute style_id.
92 93 94 |
# File 'lib/arrolio/content/table.rb', line 92 def style_id @style_id end |
#valign ⇒ Object (readonly)
Returns the value of attribute valign.
92 93 94 |
# File 'lib/arrolio/content/table.rb', line 92 def valign @valign end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
111 112 113 114 115 116 117 118 119 |
# File 'lib/arrolio/content/table.rb', line 111 def ==(other) other.is_a?(self.class) && content == other.content && colspan == other.colspan && rowspan == other.rowspan && style_id == other.style_id && align == other.align && valign == other.valign end |
#hash ⇒ Object
123 124 125 |
# File 'lib/arrolio/content/table.rb', line 123 def hash [self.class, content, colspan, rowspan, style_id, align, valign].hash end |
#text ⇒ Object
105 106 107 108 109 |
# File 'lib/arrolio/content/table.rb', line 105 def text @content.map do |node| node.is_a?(Paragraph) ? node.text : node.to_s end.join(' ') end |