Class: Samovar::Output::Row

Inherits:
Array
  • Object
show all
Defined in:
lib/samovar/output/row.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Row

Returns a new instance of Row.



24
25
26
27
# File 'lib/samovar/output/row.rb', line 24

def initialize(object)
	@object = object
	super object.to_a.collect(&:to_s)
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



29
30
31
# File 'lib/samovar/output/row.rb', line 29

def object
  @object
end

Instance Method Details

#align(columns) ⇒ Object



31
32
33
34
35
# File 'lib/samovar/output/row.rb', line 31

def align(columns)
	self.collect.with_index do |value, index|
		value.ljust(columns.widths[index])
	end.join('  ')
end