lib/reek/configuration/app_configuration.rb in reek-3.4.1 vs lib/reek/configuration/app_configuration.rb in reek-3.5.0
- old
+ new
@@ -40,14 +40,13 @@
#
# @return [AppConfiguration]
def self.from_map(map = {})
allocate.tap do |instance|
instance.instance_eval do
- self.directory_directives = map.fetch(:directory_directives, {}).
- extend(DirectoryDirectives)
- self.default_directive = map.fetch(:default_directive, {}).extend(DefaultDirective)
- self.excluded_paths = map.fetch(:excluded_paths, []).extend(ExcludedPaths)
+ load_values map.fetch(:directory_directives, {})
+ load_values map.fetch(:default_directive, {})
+ load_values EXCLUDE_PATHS_KEY => map.fetch(:excluded_paths, [])
end
end
end
def self.default
@@ -88,9 +87,13 @@
end
def find_and_load(path: nil)
configuration_file = ConfigurationFileFinder.find_and_load(path: path)
+ load_values(configuration_file)
+ end
+
+ def load_values(configuration_file)
configuration_file.each do |key, value|
case
when key == EXCLUDE_PATHS_KEY
excluded_paths.add value
when smell_type?(key)