Module: Klenod::Test::ConfigLoader

Defined in:
lib/klenod/test/config.rb

Constant Summary collapse

CONFIG_FILE =
"klenod.test.rb"

Class Method Summary collapse

Class Method Details

.find(start_dir = Dir.pwd) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/klenod/test/config.rb', line 77

def find(start_dir = Dir.pwd)
  dir = File.expand_path(start_dir)

  loop do
    path = File.join(dir, CONFIG_FILE)
    return path if File.file?(path)

    parent = File.dirname(dir)
    return nil if parent == dir

    dir = parent
  end
end

.load(path) ⇒ Object



91
92
93
94
95
# File 'lib/klenod/test/config.rb', line 91

def load(path)
  builder = ConfigBuilder.new(path)
  builder.instance_eval(File.read(path), path, 1)
  builder.config
end