Class: Reek::Overrides

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

Overview

A set of context-specific overrides for smell detectors.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Overrides

Returns a new instance of Overrides.



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

def initialize(hash)
  @hash = hash
end

Instance Attribute Details

#hashObject (readonly, private)

Returns the value of attribute hash.



63
64
65
# File 'lib/reek/smell_configuration.rb', line 63

def hash
  @hash
end

Instance Method Details

#for_context(context) ⇒ Object

Find any overrides that match the supplied context



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

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