lib/rbatch/config.rb in rbatch-2.4.0 vs lib/rbatch/config.rb in rbatch-2.5.0
- old
+ new
@@ -1,21 +1,25 @@
require 'yaml'
require 'pathname'
-
+require 'erb'
module RBatch
class Config
# Config file path
@path
# Actual data
@hash
# @param [String] path Config file path
- def initialize(path)
+ def initialize(path,is_erb = false)
@path = path
begin
- @hash = ConfigElement.new(YAML::load_file(@path))
+ if is_erb
+ @hash = ConfigElement.new(YAML::load(ERB.new(IO.read(@path)).result))
+ else
+ @hash = ConfigElement.new(YAML::load_file(@path))
+ end
rescue Errno::ENOENT => e
@hash = nil
end
end