Class: Tastytrade::HistoryFormatter
- Inherits:
-
Object
- Object
- Tastytrade::HistoryFormatter
- Defined in:
- lib/tastytrade/cli/history_formatter.rb
Overview
Formatter for displaying transaction history in various formats
Instance Method Summary collapse
-
#format_table(transactions, group_by: nil) ⇒ Object
Format transactions as a table.
-
#initialize(pastel: nil) ⇒ HistoryFormatter
constructor
A new instance of HistoryFormatter.
Constructor Details
#initialize(pastel: nil) ⇒ HistoryFormatter
Returns a new instance of HistoryFormatter.
9 10 11 |
# File 'lib/tastytrade/cli/history_formatter.rb', line 9 def initialize(pastel: nil) @pastel = pastel || Pastel.new end |
Instance Method Details
#format_table(transactions, group_by: nil) ⇒ Object
Format transactions as a table
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/tastytrade/cli/history_formatter.rb', line 14 def format_table(transactions, group_by: nil) return if transactions.empty? case group_by when :symbol format_by_symbol(transactions) when :type format_by_type(transactions) when :date format_by_date(transactions) else format_detailed_table(transactions) end end |