Class: ImproveYourCode::SmellConfiguration
- Inherits:
-
Object
- Object
- ImproveYourCode::SmellConfiguration
- Defined in:
- lib/improve_your_code/smell_configuration.rb
Constant Summary collapse
- ENABLED_KEY =
'enabled'
- OVERRIDES_KEY =
'overrides'
Instance Method Summary collapse
- #enabled? ⇒ Boolean
-
#initialize(hash) ⇒ SmellConfiguration
constructor
A new instance of SmellConfiguration.
- #merge(new_options) ⇒ Object
- #overrides_for(context) ⇒ Object
- #value(key, context) ⇒ Object
Constructor Details
#initialize(hash) ⇒ SmellConfiguration
Returns a new instance of SmellConfiguration.
8 9 10 |
# File 'lib/improve_your_code/smell_configuration.rb', line 8 def initialize(hash) @options = hash end |
Instance Method Details
#enabled? ⇒ Boolean
16 17 18 |
# File 'lib/improve_your_code/smell_configuration.rb', line 16 def enabled? [ENABLED_KEY] end |
#merge(new_options) ⇒ Object
12 13 14 |
# File 'lib/improve_your_code/smell_configuration.rb', line 12 def merge() .merge!() end |
#overrides_for(context) ⇒ Object
20 21 22 |
# File 'lib/improve_your_code/smell_configuration.rb', line 20 def overrides_for(context) Overrides.new(.fetch(OVERRIDES_KEY, {})).for_context(context) end |
#value(key, context) ⇒ Object
24 25 26 27 |
# File 'lib/improve_your_code/smell_configuration.rb', line 24 def value(key, context) overrides_for(context).each { |conf| return conf[key] if conf.key?(key) } .fetch(key) end |