Class: Feature::Repository::YamlRepository
- Inherits:
-
Object
- Object
- Feature::Repository::YamlRepository
- Defined in:
- lib/feature/repository/yaml_repository.rb
Overview
YamlRepository for active and inactive features The yaml config file should look like this:
features:
an_active_feature: true
an_inactive_feature: false
Example usage:
repository = YamlRepository.new('/path/to/yaml/file')
# use repository with Feature
Instance Method Summary collapse
-
#active_features ⇒ Array<Symbol>
Returns list of active features.
-
#initialize(yaml_file_name, environment = '') ⇒ YamlRepository
constructor
Constructor.
Constructor Details
#initialize(yaml_file_name, environment = '') ⇒ YamlRepository
Constructor
23 24 25 26 |
# File 'lib/feature/repository/yaml_repository.rb', line 23 def initialize(yaml_file_name, environment='') @yaml_file_name = yaml_file_name @environment = environment end |
Instance Method Details
#active_features ⇒ Array<Symbol>
Returns list of active features
32 33 34 35 36 |
# File 'lib/feature/repository/yaml_repository.rb', line 32 def active_features features_hash = read_and_parse_file_data features = features_hash.keys.select { |feature_key| features_hash[feature_key] } features.sort.map(&:to_sym) end |