Class: Table
- Inherits:
-
Object
- Object
- Table
- Defined in:
- lib/bean/table.rb
Instance Method Summary collapse
-
#initialize(map) ⇒ Table
constructor
A new instance of Table.
- #table ⇒ Object
Constructor Details
#initialize(map) ⇒ Table
Returns a new instance of Table.
6 7 8 9 10 |
# File 'lib/bean/table.rb', line 6 def initialize(map) @map = map @left_dash = 20 @right_dash = 20 end |
Instance Method Details
#table ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/bean/table.rb', line 12 def table r = header for (key, value) in @map left = @left_dash - key.to_s.length right = @right_dash - value.to_s.length r << "| #{key}#{indent(left)} | #{value}#{indent(right)} |\n" end r << line end |