class RuboCop::Cop::InternalAffairs::RedundantMethodDispatchNode
Checks for redundant `send_node` method dispatch node.
@example
# bad node.send_node.method_name # good node.method_name # bad node.send_node.receiver # good node.receiver
Constants
- MSG
- RESTRICT_ON_SEND
Public Instance Methods
on_send(node)
click to toggle source
# File lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb, line 34 def on_send(node) return unless (dispatch_node = dispatch_method(node)) return unless (dot = dispatch_node.loc.dot) range = range_between(dot.begin_pos, dispatch_node.loc.selector.end_pos) add_offense(range) do |corrector| corrector.remove(range) end end