Class: SmoothChange::Adapters::Yaml
- Inherits:
-
Object
- Object
- SmoothChange::Adapters::Yaml
- Defined in:
- lib/smooth_change/adapters/yaml.rb
Overview
Load features from a YAML file
Instance Method Summary collapse
- #features ⇒ Object
- #get(feature_name) ⇒ Feature
-
#initialize(file:) ⇒ Yaml
constructor
A new instance of Yaml.
Constructor Details
#initialize(file:) ⇒ Yaml
Returns a new instance of Yaml.
7 8 9 10 11 12 13 14 |
# File 'lib/smooth_change/adapters/yaml.rb', line 7 def initialize(file:) @file_content = if file.respond_to?(:read) file.read else File.read(file) end parse_file end |
Instance Method Details
#features ⇒ Object
16 17 18 |
# File 'lib/smooth_change/adapters/yaml.rb', line 16 def features @features ||= {}.with_indifferent_access end |
#get(feature_name) ⇒ Feature
22 23 24 |
# File 'lib/smooth_change/adapters/yaml.rb', line 22 def get(feature_name) @features[feature_name] end |