Module: StripeSaas::PlanFeature

Extended by:
ActiveSupport::Concern
Included in:
PlanFeature
Defined in:
app/concerns/stripe_saas/plan_feature.rb

Instance Method Summary collapse

Instance Method Details

#to_sObject



17
18
19
20
21
22
23
24
# File 'app/concerns/stripe_saas/plan_feature.rb', line 17

def to_s
  case feature.feature_type.to_sym
    when :boolean
      "#{self.value ? '' : 'No '}#{self.feature.name}"
    when :number, :percentage, :filesize, :interval
      %[#{self[:value]} #{self.feature.use_unit ? "#{self.feature.unit.pluralize(self.value).capitalize} " : ''}#{self.feature.description}]
  end
end

#valueObject



8
9
10
11
12
13
14
15
# File 'app/concerns/stripe_saas/plan_feature.rb', line 8

def value
  case feature.feature_type.to_sym
    when :boolean
      self[:value] == 'true'
    when :number, :percentage, :filesize, :interval
      self[:value].to_i
  end
end

#value=(val) ⇒ Object



4
5
6
# File 'app/concerns/stripe_saas/plan_feature.rb', line 4

def value=(val)
  super(val.to_s)
end