lib/config_loader/map.rb in configloader-0.2.2 vs lib/config_loader/map.rb in configloader-0.3.0

- old
+ new

@@ -1,23 +1,22 @@ +require 'erb' require 'yaml' module ConfigLoader - class Map - attr_reader :file_name, :running_env, :project_root def initialize(file_name, running_env, project_root) raise MissingConfigFileNameError unless file_name @file_name = "#{file_name}.yml" @running_env = running_env @project_root = project_root end def file_content - raise MissingConfigFileError unless File.exists?(full_file_name) - File.open(full_file_name) { |file| YAML::load(file) } + raise MissingConfigFileError.new(full_file_name) unless File.exists?(full_file_name) + YAML.load(ERB.new(File.read(full_file_name)).result) end def full_file_name "#{project_root}/config/#{file_name}" end @@ -27,9 +26,7 @@ end def method_missing(method_name) self[method_name] end - end - -end +end \ No newline at end of file