class Reek::SmellConfiguration
Represents a single set of configuration options for a smell detector
Constants
- ENABLED_KEY
-
The name of the config field that specifies whether a smell is enabled. Set to
true
orfalse
. - OVERRIDES_KEY
-
The name of the config field that sets scope-specific overrides for other values in the current smell detector’s configuration.
Attributes
Public Class Methods
Source
# File lib/reek/smell_configuration.rb, line 16 def initialize(hash) @options = hash end
Public Instance Methods
Source
# File lib/reek/smell_configuration.rb, line 24 def enabled? options[ENABLED_KEY] end
Source
# File lib/reek/smell_configuration.rb, line 20 def merge(new_options) options.merge!(new_options) end
Source
# File lib/reek/smell_configuration.rb, line 28 def overrides_for(context) Overrides.new(options.fetch(OVERRIDES_KEY, {})).for_context(context) end
Source
# File lib/reek/smell_configuration.rb, line 37 def value(key, context) overrides_for(context).each { |conf| return conf[key] if conf.key?(key) } options.fetch(key) end
Retrieves the value, if any, for the given key
in the given context
.
Raises an error if neither the context nor this config have a value for the key.