Class: PactBroker::FeatureToggle
- Inherits:
-
Object
- Object
- PactBroker::FeatureToggle
- Defined in:
- lib/pact_broker/feature_toggle.rb
Class Method Summary collapse
- .enabled?(feature, ignore_env) ⇒ Boolean
- .feature_in_env_var?(feature) ⇒ Boolean
- .not_production? ⇒ Boolean
Class Method Details
.enabled?(feature, ignore_env) ⇒ Boolean
5 6 7 8 9 10 11 |
# File 'lib/pact_broker/feature_toggle.rb', line 5 def self.enabled?(feature, ignore_env) if ignore_env feature_in_env_var?(feature) else not_production? || feature_in_env_var?(feature) end end |
.feature_in_env_var?(feature) ⇒ Boolean
17 18 19 |
# File 'lib/pact_broker/feature_toggle.rb', line 17 def self.feature_in_env_var?(feature) PactBroker.configuration.features[feature.to_s.downcase.to_sym] == true end |
.not_production? ⇒ Boolean
13 14 15 |
# File 'lib/pact_broker/feature_toggle.rb', line 13 def self.not_production? ENV["RACK_ENV"] != "production" end |