Class: SaveTheMonth::RecipeDsl
- Inherits:
-
Object
- Object
- SaveTheMonth::RecipeDsl
- Defined in:
- lib/recipe_dsl.rb
Instance Attribute Summary collapse
-
#charge_dsl ⇒ Object
Returns the value of attribute charge_dsl.
-
#expected_balance ⇒ Object
Returns the value of attribute expected_balance.
-
#payment_dsl ⇒ Object
Returns the value of attribute payment_dsl.
Instance Method Summary collapse
- #final_date(date) ⇒ Object
- #initial_amount(amount) ⇒ Object
- #initial_date(date) ⇒ Object
-
#initialize ⇒ RecipeDsl
constructor
A new instance of RecipeDsl.
- #to_charge(&block) ⇒ Object
- #to_pay(&block) ⇒ Object
Constructor Details
#initialize ⇒ RecipeDsl
Returns a new instance of RecipeDsl.
10 11 12 13 14 |
# File 'lib/recipe_dsl.rb', line 10 def initialize self.expected_balance = ExpectedBalance.new self.payment_dsl = PaymentDsl.new self.charge_dsl = ChargeDsl.new end |
Instance Attribute Details
#charge_dsl ⇒ Object
Returns the value of attribute charge_dsl.
8 9 10 |
# File 'lib/recipe_dsl.rb', line 8 def charge_dsl @charge_dsl end |
#expected_balance ⇒ Object
Returns the value of attribute expected_balance.
8 9 10 |
# File 'lib/recipe_dsl.rb', line 8 def expected_balance @expected_balance end |
#payment_dsl ⇒ Object
Returns the value of attribute payment_dsl.
8 9 10 |
# File 'lib/recipe_dsl.rb', line 8 def payment_dsl @payment_dsl end |
Instance Method Details
#final_date(date) ⇒ Object
20 21 22 |
# File 'lib/recipe_dsl.rb', line 20 def final_date(date) expected_balance.final_date = Date.parse(date) end |
#initial_amount(amount) ⇒ Object
24 25 26 |
# File 'lib/recipe_dsl.rb', line 24 def initial_amount(amount) expected_balance.initial_amount = amount end |
#initial_date(date) ⇒ Object
16 17 18 |
# File 'lib/recipe_dsl.rb', line 16 def initial_date(date) expected_balance.initial_date = Date.parse(date) end |
#to_charge(&block) ⇒ Object
32 33 34 |
# File 'lib/recipe_dsl.rb', line 32 def to_charge(&block) charge_dsl.evaluate_recipe(expected_balance, &block) end |
#to_pay(&block) ⇒ Object
28 29 30 |
# File 'lib/recipe_dsl.rb', line 28 def to_pay(&block) payment_dsl.evaluate_recipe(expected_balance, &block) end |