Module: StripeSaas::Feature

Extended by:
ActiveSupport::Concern
Included in:
Feature
Defined in:
app/concerns/stripe_saas/feature.rb

Constant Summary collapse

FEATURE_TYPES =
{
  boolean: 'Boolean',
  interval: 'Interval (in seconds)',
  filesize: 'Filesize (in bytes)',
  number: 'Number',
  percentage: 'Percentage (%)'
}

Instance Method Summary collapse

Instance Method Details

#feature_type=(val) ⇒ Object

Raises:

  • (ArgumentError)


12
13
14
15
16
17
# File 'app/concerns/stripe_saas/feature.rb', line 12

def feature_type=(val)
  val = val.to_sym
  raise(ArgumentError, "#{val} is not a valid feature type") unless FEATURE_TYPES.keys.include?(val)
  self[:feature_type] = val
  self[:unit] = FEATURE_TYPES[val]
end

#to_sObject



19
20
21
# File 'app/concerns/stripe_saas/feature.rb', line 19

def to_s
  name
end