Module: FeatureState
- Included in:
- Project
- Defined in:
- app/concerns/feature_state.rb
Instance Method Summary collapse
- #broken_features(*features) ⇒ Object
- #feature_broken!(feature_name) ⇒ Object
- #feature_state(feature_name) ⇒ Object
- #feature_states ⇒ Object
- #feature_working!(feature_name) ⇒ Object
- #set_feature_state!(feature_name, state) ⇒ Object
Instance Method Details
#broken_features(*features) ⇒ Object
15 16 17 |
# File 'app/concerns/feature_state.rb', line 15 def broken_features(*features) features.flatten.select { |feature_name| feature_state(feature_name) == "broken" } end |
#feature_broken!(feature_name) ⇒ Object
3 4 5 |
# File 'app/concerns/feature_state.rb', line 3 def feature_broken!(feature_name) set_feature_state! feature_name, "broken" end |
#feature_state(feature_name) ⇒ Object
11 12 13 |
# File 'app/concerns/feature_state.rb', line 11 def feature_state(feature_name) feature_states[feature_name.to_s] end |
#feature_states ⇒ Object
19 20 21 |
# File 'app/concerns/feature_state.rb', line 19 def feature_states super || {} end |
#feature_working!(feature_name) ⇒ Object
7 8 9 |
# File 'app/concerns/feature_state.rb', line 7 def feature_working!(feature_name) set_feature_state! feature_name, "working" end |
#set_feature_state!(feature_name, state) ⇒ Object
23 24 25 |
# File 'app/concerns/feature_state.rb', line 23 def set_feature_state!(feature_name, state) update_column :feature_states, feature_states.merge(feature_name.to_s => state) end |