Class: IGMarkets::CLI::Tables::Table
- Inherits:
-
Object
- Object
- IGMarkets::CLI::Tables::Table
- Defined in:
- lib/ig_markets/cli/tables/table.rb
Overview
Base class with shared table setup and display methods. Used to print output tables in the command-line client.
Direct Known Subclasses
AccountsTable, ActivitiesTable, ClientSentimentsTable, HistoricalPriceResultSnapshotsTable, MarketOverviewsTable, PerformancesTable, PositionsTable, SprintMarketPositionsTable, TransactionsTable, WorkingOrdersTable
Instance Method Summary collapse
-
#initialize(models, options = {}) ⇒ Table
constructor
Initializer that takes the array of models to display in this table.
-
#lines ⇒ Array<String>
Returns the individual formatted lines that make up this table.
-
#to_s ⇒ Object
Converts this table into a formatted string.
Constructor Details
#initialize(models, options = {}) ⇒ Table
Initializer that takes the array of models to display in this table.
11 12 13 14 |
# File 'lib/ig_markets/cli/tables/table.rb', line 11 def initialize(models, = {}) @models = Array(models).flatten @title = [:title] || default_title end |
Instance Method Details
#lines ⇒ Array<String>
Returns the individual formatted lines that make up this table.
24 25 26 |
# File 'lib/ig_markets/cli/tables/table.rb', line 24 def lines to_s.split "\n" end |
#to_s ⇒ Object
Converts this table into a formatted string.
17 18 19 |
# File 'lib/ig_markets/cli/tables/table.rb', line 17 def to_s table.to_s end |