Class: ImageOptim::Table
- Inherits:
-
Object
- Object
- ImageOptim::Table
- Defined in:
- lib/image_optim/table.rb
Overview
Handy class for pretty printing a table in the terminal. This is very simple, switch to Terminal Table, Table Tennis or similar if we need more.
Instance Attribute Summary collapse
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
Instance Method Summary collapse
-
#initialize(rows) ⇒ Table
constructor
A new instance of Table.
- #write(io) ⇒ Object
Constructor Details
#initialize(rows) ⇒ Table
Returns a new instance of Table.
9 10 11 |
# File 'lib/image_optim/table.rb', line 9 def initialize(rows) @rows = rows end |
Instance Attribute Details
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
7 8 9 |
# File 'lib/image_optim/table.rb', line 7 def rows @rows end |
Instance Method Details
#write(io) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/image_optim/table.rb', line 13 def write(io) io.puts render_row(columns) io.puts render_sep rows.each do |row| io.puts render_row(row.values) end end |