Class: PutsUtils::PutsTable::Formatter
- Inherits:
-
Object
- Object
- PutsUtils::PutsTable::Formatter
- Defined in:
- lib/puts_utils/puts_table/formatter.rb
Instance Attribute Summary collapse
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
-
#initialize(table) ⇒ Formatter
constructor
A new instance of Formatter.
- #to_s ⇒ Object
Constructor Details
#initialize(table) ⇒ Formatter
Returns a new instance of Formatter.
8 9 10 11 |
# File 'lib/puts_utils/puts_table/formatter.rb', line 8 def initialize(table) @table = table @sizes = {} end |
Instance Attribute Details
#table ⇒ Object (readonly)
Returns the value of attribute table.
6 7 8 |
# File 'lib/puts_utils/puts_table/formatter.rb', line 6 def table @table end |
Instance Method Details
#to_s ⇒ Object
13 14 15 16 17 |
# File 'lib/puts_utils/puts_table/formatter.rb', line 13 def to_s table.rows.map do |values| render_row(values) end.join("\n") end |