Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/ext/feature_branch.rb
Class Method Summary collapse
- .feature_branch(feature_name, scope = nil, &feature_work) ⇒ Object
- .feature_enabled?(feature_name, scope = nil) ⇒ Boolean
Instance Method Summary collapse
- #feature_branch(feature_name, scope = nil, &feature_work) ⇒ Object
- #feature_enabled?(feature_name, scope = nil) ⇒ Boolean
Class Method Details
.feature_branch(feature_name, scope = nil, &feature_work) ⇒ Object
4 5 6 7 8 |
# File 'lib/ext/feature_branch.rb', line 4 def feature_branch(feature_name, scope = nil, &feature_work) if feature_enabled?(feature_name, scope) feature_work.call end end |
.feature_enabled?(feature_name, scope = nil) ⇒ Boolean
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ext/feature_branch.rb', line 11 def feature_enabled?(feature_name, scope = nil) normalized_feature_name = feature_name.to_s.downcase redis_override_value = feature_enabled_reddis_override_value(normalized_feature_name) value = !redis_override_value.nil? ? redis_override_value : AbstractFeatureBranch.application_features[normalized_feature_name] if AbstractFeatureBranch.scoped_value?(value) value = !scope.nil? && feature_enabled_scoped_value(feature_name, scope) end value end |
Instance Method Details
#feature_branch(feature_name, scope = nil, &feature_work) ⇒ Object
52 53 54 |
# File 'lib/ext/feature_branch.rb', line 52 def feature_branch(feature_name, scope = nil, &feature_work) Object.feature_branch(feature_name.to_s, scope, &feature_work) end |
#feature_enabled?(feature_name, scope = nil) ⇒ Boolean
57 58 59 |
# File 'lib/ext/feature_branch.rb', line 57 def feature_enabled?(feature_name, scope = nil) Object.feature_enabled?(feature_name.to_s, scope) end |