lib/sapience/config_loader.rb in sapience-2.4.0 vs lib/sapience/config_loader.rb in sapience-2.5.0
- old
+ new
@@ -10,11 +10,11 @@
# and all its cops. A Config is associated with a YAML configuration
# file from which it was read. Several different Configs can be used
# during a run of the sapience program, if files in several
# directories are inspected.
module ConfigLoader
- SAPIENCE_FILE = "sapience.yml".freeze
+ SAPIENCE_FILE = "sapience.yml"
SAPIENCE_HOME = File.realpath(File.join(File.dirname(__FILE__), "..", ".."))
DEFAULT_FILE = File.join(SAPIENCE_HOME, "config", "default.yml")
def self.load_from_file
default_config = load_yaml_configuration(config_file_path)
@@ -22,11 +22,11 @@
merge_configs(default_config, application_config)
end
def self.merge_configs(left_config = {}, right_config = {})
left_config.each do |key, config = {}|
- right = right_config.fetch(key) { Hash.new }
+ right = right_config.fetch(key) { {} }
config.merge!(right)
end
(right_config.keys - left_config.keys).each do |left_over_key|
left_config[left_over_key] = right_config[left_over_key]
@@ -76,10 +76,10 @@
whitelisted_tags: %w(!ruby/regexp))
else
YAML.safe_load(yaml_code, [Regexp], [], false, filename)
end
else
- YAML.load(yaml_code, filename)
+ YAML.safe_load(yaml_code, filename)
end
end
end
end
end