Class: SaveTheMonth::ExpectedBalance

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeExpectedBalance

Returns a new instance of ExpectedBalance.



50
51
52
53
# File 'lib/expected_balance.rb', line 50

def initialize
  self.movements = []
  self.periodical_strategies = PaymentPeriodicalStrategies.new
end

Instance Attribute Details

#final_dateObject

Returns the value of attribute final_date.



48
49
50
# File 'lib/expected_balance.rb', line 48

def final_date
  @final_date
end

#initial_amountObject

Returns the value of attribute initial_amount.



48
49
50
# File 'lib/expected_balance.rb', line 48

def initial_amount
  @initial_amount
end

#initial_dateObject

Returns the value of attribute initial_date.



48
49
50
# File 'lib/expected_balance.rb', line 48

def initial_date
  @initial_date
end

#movementsObject

Returns the value of attribute movements.



48
49
50
# File 'lib/expected_balance.rb', line 48

def movements
  @movements
end

#periodical_strategiesObject

Returns the value of attribute periodical_strategies.



48
49
50
# File 'lib/expected_balance.rb', line 48

def periodical_strategies
  @periodical_strategies
end

Instance Method Details

#add_charge(name, &perform) ⇒ Object



55
56
57
# File 'lib/expected_balance.rb', line 55

def add_charge(name, &perform)
  movements << make_movement(:charge, name, &perform)
end

#add_payment(name, &perform) ⇒ Object



59
60
61
# File 'lib/expected_balance.rb', line 59

def add_payment(name, &perform)
  movements << make_movement(:payment, name, &perform)
end

#add_timed_charge(name, amount, date) ⇒ Object



67
68
69
# File 'lib/expected_balance.rb', line 67

def add_timed_charge(name, amount, date)
  movements << make_timed_movement(name, amount, date)
end

#add_timed_payment(name, amount, date) ⇒ Object



63
64
65
# File 'lib/expected_balance.rb', line 63

def add_timed_payment(name, amount, date)
  movements << make_timed_movement(name, -amount, date)
end