Class: Kuby::Utils::Table
- Inherits:
-
Object
- Object
- Kuby::Utils::Table
- Defined in:
- lib/kuby/utils/table.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
Instance Method Summary collapse
-
#initialize(headers, rows) ⇒ Table
constructor
A new instance of Table.
- #to_s ⇒ Object
Constructor Details
#initialize(headers, rows) ⇒ Table
Returns a new instance of Table.
6 7 8 9 |
# File 'lib/kuby/utils/table.rb', line 6 def initialize(headers, rows) @headers = headers @rows = rows end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
4 5 6 |
# File 'lib/kuby/utils/table.rb', line 4 def headers @headers end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
4 5 6 |
# File 'lib/kuby/utils/table.rb', line 4 def rows @rows end |
Instance Method Details
#to_s ⇒ Object
11 12 13 |
# File 'lib/kuby/utils/table.rb', line 11 def to_s [headers, *rows].map { |vals| make_row(vals) }.join("\n") end |