Class: Simplabs::Excellent::Checks::NestedIteratorsCheck
- Defined in:
- lib/simplabs/excellent/checks/nested_iterators_check.rb
Overview
This check reports nested iterators. Nested iterators may introduce performance issues.
Applies to
-
blocks
Instance Attribute Summary
Attributes inherited from Base
#interesting_contexts, #interesting_files, #options, #warnings
Instance Method Summary collapse
-
#evaluate(context) ⇒ Object
:nodoc:.
-
#initialize(options = {}) ⇒ NestedIteratorsCheck
constructor
:nodoc:.
Methods inherited from Base
#add_warning, #evaluate_context, #warnings_for
Constructor Details
#initialize(options = {}) ⇒ NestedIteratorsCheck
:nodoc:
16 17 18 19 20 |
# File 'lib/simplabs/excellent/checks/nested_iterators_check.rb', line 16 def initialize( = {}) #:nodoc: super @interesting_contexts = [Parsing::BlockContext] @interesting_files = [/\.rb$/, /\.erb$/] end |
Instance Method Details
#evaluate(context) ⇒ Object
:nodoc:
22 23 24 25 26 |
# File 'lib/simplabs/excellent/checks/nested_iterators_check.rb', line 22 def evaluate(context) #:nodoc: if context.inside_block? add_warning(context, '{{block}} inside of {{parent}}.', { :block => context.full_name, :parent => context.parent.full_name }) end end |