Class: Togls::Feature
- Inherits:
-
Object
- Object
- Togls::Feature
- Defined in:
- lib/togls/feature.rb
Overview
Feature
The Feature model is the business representation of a feature. It is how Togls primarily interfaces with the concept of a feature.
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(key, description, target_type) ⇒ Feature
constructor
A new instance of Feature.
- #missing_target_type? ⇒ Boolean
- #target_type ⇒ Object
Constructor Details
#initialize(key, description, target_type) ⇒ Feature
Returns a new instance of Feature.
9 10 11 12 13 14 |
# File 'lib/togls/feature.rb', line 9 def initialize(key, description, target_type) @key = key.to_s @description = description @target_type = target_type raise Togls::FeatureMissingTargetType, "Feature '#{self.key}' is missing a required target type" if self.missing_target_type? end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
7 8 9 |
# File 'lib/togls/feature.rb', line 7 def description @description end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/togls/feature.rb', line 7 def key @key end |
Instance Method Details
#id ⇒ Object
21 22 23 |
# File 'lib/togls/feature.rb', line 21 def id @key end |
#missing_target_type? ⇒ Boolean
25 26 27 28 |
# File 'lib/togls/feature.rb', line 25 def missing_target_type? return false if target_type && (target_type != Togls::TargetTypes::NOT_SET) return true end |
#target_type ⇒ Object
16 17 18 19 |
# File 'lib/togls/feature.rb', line 16 def target_type return @target_type unless @target_type.nil? return Togls::TargetTypes::NOT_SET end |