Class: Cp8Cli::Table::Row
- Inherits:
-
Object
- Object
- Cp8Cli::Table::Row
- Defined in:
- lib/cp8_cli/table/row.rb
Constant Summary collapse
- COLOR_TRANSLATIONS =
{ "purple" => "magenta", "orange" => "yellow", "sky" => "cyan", "pink" => "red", "lime" => "green" }
Instance Method Summary collapse
-
#initialize(record, index) ⇒ Row
constructor
A new instance of Row.
- #to_h ⇒ Object
Constructor Details
#initialize(record, index) ⇒ Row
Returns a new instance of Row.
14 15 16 17 |
# File 'lib/cp8_cli/table/row.rb', line 14 def initialize(record, index) @record = record @num = index + 1 end |
Instance Method Details
#to_h ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/cp8_cli/table/row.rb', line 19 def to_h result = { "#": num } fields.each do |field| result[field] = colorize record.send(field) end result end |