Module: Pageflow::FeatureTarget Private
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/pageflow/feature_target.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- STATE_MAPPING =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ true => 'enabled', false => 'disabled' }
Instance Method Summary collapse
- #enabled_feature_names ⇒ Object private
- #feature_state(name) ⇒ Object private
- #feature_states=(states) ⇒ Object private
- #features_configuration ⇒ Object private
Instance Method Details
#enabled_feature_names ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 18 19 |
# File 'app/models/concerns/pageflow/feature_target.rb', line 15 def enabled_feature_names Pageflow.config.features.select do |feature| feature_state(feature.name) == true end.map(&:name) end |
#feature_state(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'app/models/concerns/pageflow/feature_target.rb', line 21 def feature_state(name) features_configuration[name] end |
#feature_states=(states) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 28 29 30 31 |
# File 'app/models/concerns/pageflow/feature_target.rb', line 25 def feature_states=(states) boolean_states = states.each_with_object({}) do |(key, value), result| result[key] = (value == true || value == STATE_MAPPING[true]) end self.features_configuration = features_configuration.merge(boolean_states) end |
#features_configuration ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 |
# File 'app/models/concerns/pageflow/feature_target.rb', line 33 def features_configuration super || {} end |