Class: SaveTheMonth::ExpectedAmountQuery
- Inherits:
-
Object
- Object
- SaveTheMonth::ExpectedAmountQuery
- Defined in:
- lib/query_dsl.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#balance ⇒ Object
Returns the value of attribute balance.
Instance Method Summary collapse
- #at_beginning ⇒ Object
- #at_date(boundary_date) ⇒ Object
- #at_end ⇒ Object
-
#initialize(balance) ⇒ ExpectedAmountQuery
constructor
A new instance of ExpectedAmountQuery.
- #today ⇒ Object
Constructor Details
#initialize(balance) ⇒ ExpectedAmountQuery
Returns a new instance of ExpectedAmountQuery.
5 6 7 |
# File 'lib/query_dsl.rb', line 5 def initialize(balance) self.balance = balance end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
3 4 5 |
# File 'lib/query_dsl.rb', line 3 def amount @amount end |
#balance ⇒ Object
Returns the value of attribute balance.
3 4 5 |
# File 'lib/query_dsl.rb', line 3 def balance @balance end |
Instance Method Details
#at_beginning ⇒ Object
9 10 11 |
# File 'lib/query_dsl.rb', line 9 def at_beginning balance.initial_amount end |
#at_date(boundary_date) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/query_dsl.rb', line 21 def at_date(boundary_date) self.amount = balance.initial_amount (balance.initial_date..boundary_date).each do |date| update_with_day(date) end self.amount end |
#at_end ⇒ Object
17 18 19 |
# File 'lib/query_dsl.rb', line 17 def at_end at_date balance.final_date end |
#today ⇒ Object
13 14 15 |
# File 'lib/query_dsl.rb', line 13 def today at_date Date.new end |