Class: LlmCostTracker::Ledger::Period::Totals
- Inherits:
-
Object
- Object
- LlmCostTracker::Ledger::Period::Totals
- Defined in:
- lib/llm_cost_tracker/ledger/period/totals.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(periods, time:) ⇒ Totals
constructor
A new instance of Totals.
- #totals ⇒ Object
Constructor Details
#initialize(periods, time:) ⇒ Totals
Returns a new instance of Totals.
15 16 17 18 |
# File 'lib/llm_cost_tracker/ledger/period/totals.rb', line 15 def initialize(periods, time:) @periods = Period.valid_keys(periods) @time = time end |
Class Method Details
.call(periods, time:) ⇒ Object
11 12 13 |
# File 'lib/llm_cost_tracker/ledger/period/totals.rb', line 11 def self.call(periods, time:) new(periods, time: time).totals end |
Instance Method Details
#totals ⇒ Object
20 21 22 23 24 |
# File 'lib/llm_cost_tracker/ledger/period/totals.rb', line 20 def totals return {} if periods.empty? snapshot_totals end |