Class: Reek::Smells::Overrides Private

Inherits:
Object
  • Object
show all
Defined in:
lib/reek/smells/smell_configuration.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A set of context-specific overrides for smell detectors.

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Overrides

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Overrides.



51
52
53
# File 'lib/reek/smells/smell_configuration.rb', line 51

def initialize(hash)
  @hash = hash
end

Instance Method Details

#for_context(context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Find any overrides that match the supplied context



56
57
58
59
# File 'lib/reek/smells/smell_configuration.rb', line 56

def for_context(context)
  contexts = @hash.keys.select { |ckey| context.matches?([ckey]) }
  contexts.map { |exc| @hash[exc] }
end