Class: FundingPrimer::Format::Table
- Inherits:
-
Object
- Object
- FundingPrimer::Format::Table
- Defined in:
- lib/funding_primer/format/table.rb
Instance Method Summary collapse
-
#initialize(array, output = STDOUT) ⇒ Table
constructor
store the output and initialize the table with row separators.
- #print ⇒ Object
Constructor Details
#initialize(array, output = STDOUT) ⇒ Table
store the output and initialize the table with row separators
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/funding_primer/format/table.rb', line 7 def initialize(array,output=STDOUT) @output = output @table = Terminal::Table.new do |t| # add each row apart from the last one with a separator array[0..-2].each do |row| t.add_row row t.add_separator end # add the last row without a separator t.add_row array.last end # set left and right alignments of columns # @table.align_column end |
Instance Method Details
#print ⇒ Object
24 25 26 |
# File 'lib/funding_primer/format/table.rb', line 24 def print @output.puts @table end |