Sha256: 39f9515b5d633a0a9d1fbe44442bbd28a227b59224133204394ab7e9d838c0be

Contents?: true

Size: 560 Bytes

Versions: 3

Compression:

Stored size: 560 Bytes

Contents

module Freemium
  module Rates

    # returns the daily cost of this plan.
    def daily_rate(options = {})
      yearly_rate(options) / 365
    end

    # returns the yearly cost of this plan.
    def yearly_rate(options = {})
      begin
        rate(options) * 12
      rescue
        rate * 12
      end
    end

    # returns the monthly cost of this plan.
    def monthly_rate(options = {})
      begin
        rate(options)
      rescue
        rate
      end
    end

    def paid?
      return false unless rate
      rate.cents > 0
    end

  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
freemium-ajb-0.0.4 lib/freemium/rates.rb
freemium-0.0.2 lib/freemium/rates.rb
freemium-0.0.1 lib/freemium/rates.rb