Class: Cp8Cli::Table
- Inherits:
-
Object
- Object
- Cp8Cli::Table
- Defined in:
- lib/cp8_cli/table.rb,
lib/cp8_cli/table/row.rb
Defined Under Namespace
Classes: Row
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(records) ⇒ Table
constructor
A new instance of Table.
- #pick(caption) ⇒ Object
Constructor Details
#initialize(records) ⇒ Table
Returns a new instance of Table.
9 10 11 |
# File 'lib/cp8_cli/table.rb', line 9 def initialize(records) @records = records.to_a.sort_by(&:position) end |
Class Method Details
.pick(records, caption: "Pick one:") ⇒ Object
5 6 7 |
# File 'lib/cp8_cli/table.rb', line 5 def self.pick(records, caption: "Pick one:") new(records).pick() end |