Class: TWKB::Formatter
- Inherits:
-
Object
- Object
- TWKB::Formatter
- Defined in:
- lib/twkb/formatter.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ Formatter
constructor
A new instance of Formatter.
- #table ⇒ Object
Constructor Details
#initialize(options) ⇒ Formatter
Returns a new instance of Formatter.
6 7 8 9 10 11 12 13 14 |
# File 'lib/twkb/formatter.rb', line 6 def initialize() raise ArgumentError, 'Missing :stages argument' unless [:stages] raise ArgumentError, ':stages is not a Hash' unless [:stages].is_a? Hash @cell_width = [:cell_width] @cell_width ||= 15 @stages = [:stages] @title = [:title] prepare end |
Instance Method Details
#table ⇒ Object
16 17 18 19 |
# File 'lib/twkb/formatter.rb', line 16 def table stage_labels = @stages.keys.map{|k,v| @stages[k][:label]} Terminal::Table.new :title => @title, :headings => stage_labels, :rows => [@lanes] end |