Class: Ballista::Projection

Inherits:
Object
  • Object
show all
Defined in:
lib/ballista/projection.rb

Overview

Projection class for creating journals

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Projection

Returns a new instance of Projection.



8
9
10
# File 'lib/ballista/projection.rb', line 8

def initialize(params = {})
  @entries = params[:entries]
end

Instance Method Details

#project(months) ⇒ Object



12
13
14
15
16
17
# File 'lib/ballista/projection.rb', line 12

def project(months)
  start = Date.today + 1
  finish = start >> months
  entries = start.upto(finish).map { |date| parse_day(date) }
  Ledger.new(entries: entries.flatten)
end