Class: FeatureFlagger::Configuration
- Inherits:
-
Object
- Object
- FeatureFlagger::Configuration
- Defined in:
- lib/feature_flagger/configuration.rb
Instance Attribute Summary collapse
-
#storage ⇒ Object
Returns the value of attribute storage.
-
#yaml_filepath ⇒ Object
Returns the value of attribute yaml_filepath.
Instance Method Summary collapse
- #info ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #mapped_feature_keys(resource_name = nil) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
7 8 9 10 |
# File 'lib/feature_flagger/configuration.rb', line 7 def initialize @storage ||= Storage::Redis.default_client @yaml_filepath ||= default_yaml_filepath end |
Instance Attribute Details
#storage ⇒ Object
Returns the value of attribute storage.
5 6 7 |
# File 'lib/feature_flagger/configuration.rb', line 5 def storage @storage end |
#yaml_filepath ⇒ Object
Returns the value of attribute yaml_filepath.
5 6 7 |
# File 'lib/feature_flagger/configuration.rb', line 5 def yaml_filepath @yaml_filepath end |
Instance Method Details
#info ⇒ Object
12 13 14 15 16 |
# File 'lib/feature_flagger/configuration.rb', line 12 def info raise 'Missing configuration file.' unless yaml_filepath @info ||= YAML.load_file(yaml_filepath) end |
#mapped_feature_keys(resource_name = nil) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/feature_flagger/configuration.rb', line 18 def mapped_feature_keys(resource_name = nil) info_filtered = resource_name ? info[resource_name] : info [].tap do |keys| make_keys_recursively(info_filtered).each { |key| keys.push(join_key(resource_name, key)) } end end |