Module: Freemium::Rates
- Included in:
- Subscription, SubscriptionPlan
- Defined in:
- lib/freemium/rates.rb
Instance Method Summary collapse
-
#daily_rate(options = {}) ⇒ Object
returns the daily cost of this plan.
-
#monthly_rate(options = {}) ⇒ Object
returns the monthly cost of this plan.
- #paid? ⇒ Boolean
-
#yearly_rate(options = {}) ⇒ Object
returns the yearly cost of this plan.
Instance Method Details
#daily_rate(options = {}) ⇒ Object
returns the daily cost of this plan.
5 6 7 |
# File 'lib/freemium/rates.rb', line 5 def daily_rate( = {}) yearly_rate() / 365 end |
#monthly_rate(options = {}) ⇒ Object
returns the monthly cost of this plan.
19 20 21 22 23 24 25 |
# File 'lib/freemium/rates.rb', line 19 def monthly_rate( = {}) begin rate() rescue rate end end |
#paid? ⇒ Boolean
27 28 29 30 |
# File 'lib/freemium/rates.rb', line 27 def paid? return false unless rate rate.cents > 0 end |
#yearly_rate(options = {}) ⇒ Object
returns the yearly cost of this plan.
10 11 12 13 14 15 16 |
# File 'lib/freemium/rates.rb', line 10 def yearly_rate( = {}) begin rate() * 12 rescue rate * 12 end end |