Module: FeatureFlags
- Defined in:
- lib/feature_flags.rb,
lib/feature_flags/engine.rb,
lib/feature_flags/version.rb,
lib/feature_flags/configuration.rb,
lib/generators/feature_flags/install_generator.rb
Defined Under Namespace
Modules: Generators
Classes: Configuration, Engine
Constant Summary
collapse
- VERSION =
"0.0.1"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
13
14
15
|
# File 'lib/feature_flags/configuration.rb', line 13
def configuration
@configuration
end
|
Class Method Details
16
17
18
19
|
# File 'lib/feature_flags/configuration.rb', line 16
def self.configure
self.configuration ||= Configuration.new
yield(configuration) if block_given?
end
|
.disable_all ⇒ Object
27
28
29
|
# File 'lib/feature_flags.rb', line 27
def self.disable_all
Feature.update_all(:status => false)
end
|
.enable_all ⇒ Object
31
32
33
|
# File 'lib/feature_flags.rb', line 31
def self.enable_all
Feature.update_all(:status => true)
end
|
.enabled?(feature_name) ⇒ Boolean
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/feature_flags.rb', line 10
def self.enabled?(feature_name)
feature = Feature.where(:name => feature_name).first
if feature.present?
feature.status? ? true : false
elsif
Feature.create!(:name => feature_name, :status => true)
return true
end
end
|
.set_disabled(feature_name) ⇒ Object
22
23
24
25
|
# File 'lib/feature_flags.rb', line 22
def self.set_disabled(feature_name)
feature = Feature.where(:name => feature_name).first
(feature.present? && feature.update_attributes(:status => false)) ? true : false
end
|