Class: Gemat::Formatter
- Inherits:
-
Object
- Object
- Gemat::Formatter
- Defined in:
- lib/formatter.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(gems, columns, write_path: nil) ⇒ Formatter
constructor
A new instance of Formatter.
- #run ⇒ Object
Constructor Details
#initialize(gems, columns, write_path: nil) ⇒ Formatter
Returns a new instance of Formatter.
5 6 7 8 9 10 11 12 |
# File 'lib/formatter.rb', line 5 def initialize(gems, columns, write_path: nil) @gems = gems @columns = columns @write_path = write_path @rows = [] set_column_name_length gen_rows end |
Instance Method Details
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/formatter.rb', line 14 def run if @write_path File.open(@write_path, 'w') do |file| each_write(@rows) { |string| file << string } end else print "\n\n" each_write(@rows) { |string| print string } print "\n" end end |