Class: Statement
- Inherits:
-
Object
- Object
- Statement
- Defined in:
- app/models/statement.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#period_end ⇒ Object
Returns the value of attribute period_end.
-
#period_start ⇒ Object
Returns the value of attribute period_start.
Instance Method Summary collapse
- #end_balance ⇒ Object
- #entries ⇒ Object
-
#initialize(account, period_start, period_end) ⇒ Statement
constructor
A new instance of Statement.
- #start_balance ⇒ Object
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(account, period_start, period_end) @account = account @period_start = period_start @period_end = period_end end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
2 3 4 |
# File 'app/models/statement.rb', line 2 def account @account end |
#period_end ⇒ Object
Returns the value of attribute period_end.
2 3 4 |
# File 'app/models/statement.rb', line 2 def period_end @period_end end |
#period_start ⇒ Object
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_balance ⇒ Object
20 21 22 |
# File 'app/models/statement.rb', line 20 def end_balance account.balance_at(period_end).balance end |
#entries ⇒ Object
10 11 12 13 14 |
# File 'app/models/statement.rb', line 10 def entries account.entries.where(entry_conditions). joins(:transaction). order("created_at ASC") end |
#start_balance ⇒ Object
16 17 18 |
# File 'app/models/statement.rb', line 16 def start_balance account.balance_at(period_start).balance end |