Class: Samovar::Output::Row
- Inherits:
-
Array
- Object
- Array
- Samovar::Output::Row
- Defined in:
- lib/samovar/output/row.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #align(columns) ⇒ Object
-
#initialize(object) ⇒ Row
constructor
A new instance of Row.
Constructor Details
#initialize(object) ⇒ Row
Returns a new instance of Row.
9 10 11 12 |
# File 'lib/samovar/output/row.rb', line 9 def initialize(object) @object = object super object.to_a.collect(&:to_s) end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
14 15 16 |
# File 'lib/samovar/output/row.rb', line 14 def object @object end |
Instance Method Details
#align(columns) ⇒ Object
16 17 18 19 20 |
# File 'lib/samovar/output/row.rb', line 16 def align(columns) self.collect.with_index do |value, index| value.ljust(columns.widths[index]) end.join(' ') end |