class SaveTheMonth::PaymentPeriodicalStrategies
Public Instance Methods
daily(amount)
click to toggle source
# File lib/expected_balance.rb, line 29 def daily(amount) # everyday this should be substracted or added can_perform = ->(given_date, initial_date){ true } PeriodicalStrategy.new(amount, can_perform) end
weekly(amount)
click to toggle source
# File lib/expected_balance.rb, line 35 def weekly(amount) can_perform = ->(given_date, initial_date) do # every week. I can only happen if today # is one of the next days: [6, 13, 20 or 27 days after the initial date] week_days = [ initial_date + 6, initial_date + 13, initial_date + 20, initial_date + 27] week_days.include?(given_date) end PeriodicalStrategy.new(amount, can_perform) end