Class: Reek::Smells::DuplicateMethodCall::CallCollector Private
- Inherits:
-
Object
- Object
- Reek::Smells::DuplicateMethodCall::CallCollector
- Defined in:
- lib/reek/smells/duplicate_method_call.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.
Collects all calls in a given context
Instance Attribute Summary collapse
- #context ⇒ Object readonly private
Instance Method Summary collapse
- #calls ⇒ Object private
-
#initialize(context, max_allowed_calls, allow_calls) ⇒ CallCollector
constructor
private
A new instance of CallCollector.
- #smelly_calls ⇒ Object private
Constructor Details
#initialize(context, max_allowed_calls, allow_calls) ⇒ CallCollector
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 CallCollector.
91 92 93 94 95 |
# File 'lib/reek/smells/duplicate_method_call.rb', line 91 def initialize(context, max_allowed_calls, allow_calls) @context = context @max_allowed_calls = max_allowed_calls @allow_calls = allow_calls end |
Instance Attribute Details
#context ⇒ Object (readonly)
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.
89 90 91 |
# File 'lib/reek/smells/duplicate_method_call.rb', line 89 def context @context end |
Instance Method Details
#calls ⇒ 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.
97 98 99 100 101 |
# File 'lib/reek/smells/duplicate_method_call.rb', line 97 def calls result = Hash.new { |hash, key| hash[key] = FoundCall.new(key) } collect_calls(result) result.values.sort_by(&:call) end |
#smelly_calls ⇒ 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.
103 104 105 |
# File 'lib/reek/smells/duplicate_method_call.rb', line 103 def smelly_calls calls.select { |found_call| smelly_call? found_call } end |