Class: Reek::Overrides
- Inherits:
-
Object
- Object
- Reek::Overrides
- Defined in:
- lib/reek/smell_configuration.rb
Overview
A set of context-specific overrides for smell detectors.
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
private
Returns the value of attribute hash.
Instance Method Summary collapse
-
#for_context(context) ⇒ Object
Find any overrides that match the supplied context.
-
#initialize(hash) ⇒ Overrides
constructor
A new instance of Overrides.
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
#hash ⇒ Object (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 |