Class: SmoothChange::Feature
- Inherits:
-
Object
- Object
- SmoothChange::Feature
- Defined in:
- lib/smooth_change/feature.rb
Overview
A feature to be mentioned by a feature flag
Instance Attribute Summary collapse
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #default_enabled_value ⇒ Boolean
- #enabled_with?(feature_toggler) ⇒ Boolean
-
#initialize(name, mode) ⇒ Feature
constructor
A new instance of Feature.
Constructor Details
#initialize(name, mode) ⇒ Feature
Returns a new instance of Feature.
9 10 11 12 |
# File 'lib/smooth_change/feature.rb', line 9 def initialize(name, mode) self.name = name self.mode = mode end |
Instance Attribute Details
#mode ⇒ Object
Returns the value of attribute mode.
7 8 9 |
# File 'lib/smooth_change/feature.rb', line 7 def mode @mode end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/smooth_change/feature.rb', line 6 def name @name end |
Instance Method Details
#default_enabled_value ⇒ Boolean
34 35 36 |
# File 'lib/smooth_change/feature.rb', line 34 def default_enabled_value mode == :opt_out end |
#enabled_with?(feature_toggler) ⇒ Boolean
26 27 28 29 30 31 |
# File 'lib/smooth_change/feature.rb', line 26 def enabled_with?(feature_toggler) value = feature_toggler.value_for(name) return default_enabled_value if value.nil? !!value end |