Module: RuboCop::Cop::ClassSendNodeHelper

Included in:
Rails::AfterCommitOverride, Rails::DuplicateAssociation, Rails::DuplicateScope
Defined in:
lib/rubocop/cop/mixin/class_send_node_helper.rb

Overview

A mixin to return all of the class send nodes.

Instance Method Summary collapse

Instance Method Details

#class_send_nodes(class_node) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rubocop/cop/mixin/class_send_node_helper.rb', line 7

def class_send_nodes(class_node)
  class_def = class_node.body

  return [] unless class_def

  if class_def.send_type?
    [class_def]
  else
    class_def.each_child_node(:send)
  end
end