Class: SimpleConfig::YAMLParser

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_config.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_yaml_data) ⇒ YAMLParser

Returns a new instance of YAMLParser.



164
165
166
167
# File 'lib/simple_config.rb', line 164

def initialize(raw_yaml_data)
  require 'yaml'
  @data = YAML.load(raw_yaml_data)
end

Class Method Details

.parse_contents_of_file(yaml_file) ⇒ Object



169
170
171
# File 'lib/simple_config.rb', line 169

def self.parse_contents_of_file(yaml_file)
  new(File.read(yaml_file))
end

Instance Method Details

#parse_into(config) ⇒ Object



173
174
175
# File 'lib/simple_config.rb', line 173

def parse_into(config)
  config.merge!(@data)
end