Class: Pcrd::Config::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/pcrd/config/loader.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Loader

Returns a new instance of Loader.



22
23
24
# File 'lib/pcrd/config/loader.rb', line 22

def initialize(path)
  @path = path
end

Class Method Details

.load(path) ⇒ Object

Returns a Config::Root. Raises Config::LoadError on any problem.



18
19
20
# File 'lib/pcrd/config/loader.rb', line 18

def self.load(path)
  new(path).load
end

Instance Method Details

#loadObject



26
27
28
29
30
31
# File 'lib/pcrd/config/loader.rb', line 26

def load
  raw  = read_file
  data = parse_yaml(raw)
  validate!(data)
  build(data)
end