Module: Saucy::Plan

Extended by:
ActiveSupport::Concern
Included in:
Plan
Defined in:
lib/saucy/plan.rb

Instance Method Summary collapse

Instance Method Details

#allows?(limit) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/saucy/plan.rb', line 44

def allows?(limit)
  limits.boolean.named(limit).allowed?
end

#billed?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/saucy/plan.rb', line 36

def billed?
  !free?
end

#can_add_more?(limit, amount) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/saucy/plan.rb', line 40

def can_add_more?(limit, amount)
  limits.numbered.named(limit).value > amount
end

#free?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/saucy/plan.rb', line 32

def free?
  price.zero?
end

#limit(limit_name) ⇒ Object



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

def limit(limit_name)
  limits.named(limit_name)
end