lib/hieracles/hiera.rb in hieracles-0.3.0 vs lib/hieracles/hiera.rb in hieracles-0.3.1

- old
+ new

@@ -1,16 +1,17 @@ module Hieracles class Hiera - def initialize - raise IOError, "Hierafile #{Config.hierafile} not found." unless File.exist? Config.hierafile - @hierafile = Config.hierafile + def initialize(config) + @config = config + raise IOError, "Hierafile #{@config.hierafile} not found." unless File.exist? @config.hierafile + @hierafile = @config.hierafile @loaded = YAML.load_file(@hierafile) end def datapath raise TypeError, "Sorry hieracles only knows yaml backend for now." unless @loaded[:yaml] - parampath = File.expand_path(File.join(Config.basepath, datadir)) + parampath = File.expand_path(File.join(@config.basepath, datadir)) raise IOError, "Params dir #{parampath} not found." unless Dir.exist? parampath parampath end def hierarchy