Method: RuboCop::Cop::Primer::DeprecatedComponents#on_send

Defined in:
lib/rubocop/cop/primer/deprecated_components.rb

#on_send(node) ⇒ Object

[View source]

27
28
29
30
31
32
33
34
# File 'lib/rubocop/cop/primer/deprecated_components.rb', line 27

def on_send(node)
  return unless node.source.include?("Primer::")

  deprecated_components.each do |component|
    pattern = NodePattern.new("(send #{pattern(component)} :new ...)")
    add_offense(node, message: message(component)) if pattern.match(node)
  end
end