Class: Tabulo::Row
Instance Method Summary collapse
-
#each ⇒ Object
Calls the given block once for each cell in the Row, passing that cell as parameter.
-
#to_h ⇒ Object
A Hash representation of the Row, with column labels acting as keys and the calculated cell values (before formatting) providing the values.
- #to_s ⇒ Object
Instance Method Details
#each ⇒ Object
Calls the given block once for each cell in the Tabulo::Row, passing that cell as parameter. Each “cell” is just the calculated value for its column (pre-formatting) for this Tabulo::Row‘s source item.
24 25 26 27 28 |
# File 'lib/tabulo/row.rb', line 24 def each @table.columns.each do |column| yield column.body_cell_value(@source) end end |
#to_h ⇒ Object
Returns a Hash representation of the Tabulo::Row, with column labels acting as keys and the calculated cell values (before formatting) providing the values.
45 46 47 |
# File 'lib/tabulo/row.rb', line 45 def to_h @table.columns.map(&:label).zip(to_a).to_h end |
#to_s ⇒ Object
Returns a String being an “ASCII” graphical representation of the Tabulo::Row, including any column headers that appear just above it in the Table (depending on where this Row is in the Table and how the Table was configured with respect to header frequency).
33 34 35 |
# File 'lib/tabulo/row.rb', line 33 def to_s @table.formatted_body_row(@source, with_header: @with_header) end |