Module: Compath::ConfigLoader

Defined in:
lib/compath/config_loader.rb

Class Method Summary collapse

Class Method Details

.load(config) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/compath/config_loader.rb', line 4

def load(config)
  conf = YAML.load(config)

  guides = conf.map do |guide_hash|
    path = guide_hash.keys.first
    options = guide_hash.values.first
    options = options.each_with_object({}) do |(key, value), hash|
      hash[key.to_sym] = value
    end
    Guide.new(path, **options)
  end
end