Parent

Class/Module Index [+]

Quicksearch

Reek::Core::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 or false.

OVERRIDES_KEY

The name of the config field that sets scope-specific overrides for other values in the current smell detector’s configuration.

Public Class Methods

new(hash) click to toggle source
# File lib/reek/core/smell_configuration.rb, line 17
def initialize(hash)
  @options = hash
end

Public Instance Methods

adopt!(options) click to toggle source
# File lib/reek/core/smell_configuration.rb, line 21
def adopt!(options)
  @options.adopt!(options)
end
enabled?() click to toggle source

Is this smell detector active?

# File lib/reek/core/smell_configuration.rb, line 29
def enabled?
  @options[ENABLED_KEY]
end
overrides_for(context) click to toggle source
# File lib/reek/core/smell_configuration.rb, line 33
def overrides_for(context)
  Overrides.new(@options.fetch(OVERRIDES_KEY, {})).for_context(context)
end
value(key, context, fall_back) click to toggle source

Retrieves the value, if any, for the given key.

Returns fall_back if this config has no value for the key.

# File lib/reek/core/smell_configuration.rb, line 41
def value(key, context, fall_back)
  overrides_for(context).each { |conf| return conf[key] if conf.has_key?(key) }
  return @options.fetch(key, fall_back)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.