Class: Statement

Inherits:
Object
  • Object
show all
Defined in:
app/models/statement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account, period_start, period_end) ⇒ Statement

Returns a new instance of Statement.



4
5
6
7
8
# File 'app/models/statement.rb', line 4

def initialize(, period_start, period_end)
  @account = 
  @period_start = period_start
  @period_end = period_end
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



2
3
4
# File 'app/models/statement.rb', line 2

def 
  @account
end

#period_endObject

Returns the value of attribute period_end.



2
3
4
# File 'app/models/statement.rb', line 2

def period_end
  @period_end
end

#period_startObject

Returns the value of attribute period_start.



2
3
4
# File 'app/models/statement.rb', line 2

def period_start
  @period_start
end

Instance Method Details

#end_balanceObject



20
21
22
# File 'app/models/statement.rb', line 20

def end_balance
  .balance_at(period_end).balance
end

#entriesObject



10
11
12
13
14
# File 'app/models/statement.rb', line 10

def entries
  .entries.where(entry_conditions).
                  joins(:transaction).
                  order("created_at ASC")
end

#start_balanceObject



16
17
18
# File 'app/models/statement.rb', line 16

def start_balance
  .balance_at(period_start).balance
end