Class: FixedWidthColumns

Inherits:
Object
  • Object
show all
Includes:
Aduki::Initializer
Defined in:
lib/fixed_width_columns.rb,
lib/fixed_width_columns/version.rb,
lib/fixed_width_columns/fixed_width_attribute.rb

Defined Under Namespace

Classes: FixedWidthAttribute

Constant Summary collapse

VERSION =
"0.0.3"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#columnsObject

Returns the value of attribute columns.



8
9
10
# File 'lib/fixed_width_columns.rb', line 8

def columns
  @columns
end

Instance Method Details

#format(thing) ⇒ Object



15
16
17
# File 'lib/fixed_width_columns.rb', line 15

def format thing
  columns.map { |col| col.string_for thing }.join
end

#headersObject



11
12
13
# File 'lib/fixed_width_columns.rb', line 11

def headers
  columns.map { |col| col.format(col.name.to_s, :padding => ' ') }.join
end