Sha256: 8a07eb51ea1e7313d4929adc82777c8479cc9417a8073f46673747b4c3cbcf2d
Contents?: true
Size: 817 Bytes
Versions: 3
Compression:
Stored size: 817 Bytes
Contents
module Pageflow # @api private module FeatureTarget STATE_MAPPING = { true => 'enabled', false => 'disabled' } extend ActiveSupport::Concern included do serialize :features_configuration, JSON end def enabled_feature_names Pageflow.config.features.select do |feature| feature_state(feature.name) == true end.map(&:name) end def feature_state(name) features_configuration[name] end 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 def features_configuration super || {} end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pageflow-0.9.2 | app/models/concerns/pageflow/feature_target.rb |
pageflow-0.9.1 | app/models/concerns/pageflow/feature_target.rb |
pageflow-0.9.0 | app/models/concerns/pageflow/feature_target.rb |