Sha256: 791936769b62337b151b59a8272c1939904a7e2107027649a1bf95abbc671d6f
Contents?: true
Size: 967 Bytes
Versions: 9
Compression:
Stored size: 967 Bytes
Contents
module Hieracles class Hiera 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)) raise IOError, "Params dir #{parampath} not found." unless Dir.exist? parampath parampath end def hierarchy @loaded[:hierarchy] end def datadir @loaded[:yaml][:datadir] end def params hierarchy.join(',').scan(/%\{(?:::)?([^\}]*)\}/).flatten.uniq end def merge_behavior case @loaded[:merge_behavior] when :deep,'deep',:deeper,'deeper' @loaded[:merge_behavior].to_sym else :native end end end end
Version data entries
9 entries across 9 versions & 1 rubygems