Class: PaidUp::FeatureSettingType

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::AttributeMethods, ActiveModel::Model
Defined in:
lib/paid_up/feature_setting_type.rb

Overview

Feature Setting Type Class: Not an ActiveRecord object.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/paid_up/feature_setting_type.rb', line 10

def name
  @name
end

#userObject

Returns the value of attribute user.



10
11
12
# File 'lib/paid_up/feature_setting_type.rb', line 10

def user
  @user
end

Instance Method Details

#idsObject



29
30
31
# File 'lib/paid_up/feature_setting_type.rb', line 29

def ids
  rows.ids
end

#modelObject



37
38
39
# File 'lib/paid_up/feature_setting_type.rb', line 37

def model
  name.classify.constantize
end

#rowsObject



25
26
27
# File 'lib/paid_up/feature_setting_type.rb', line 25

def rows
  scope.where(user: user)
end

#rows_allowedObject



21
22
23
# File 'lib/paid_up/feature_setting_type.rb', line 21

def rows_allowed
  plan.feature_setting name
end

#rows_countObject



33
34
35
# File 'lib/paid_up/feature_setting_type.rb', line 33

def rows_count
  rows.size
end

#rows_remainingObject



17
18
19
# File 'lib/paid_up/feature_setting_type.rb', line 17

def rows_remaining
  rows_allowed - rows_count
end

#rows_unlimited?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/paid_up/feature_setting_type.rb', line 13

def rows_unlimited?
  rows_allowed == PaidUp::Unlimited.to_i
end

#scopeObject



41
42
43
# File 'lib/paid_up/feature_setting_type.rb', line 41

def scope
  model.paid_for_scope
end