class RuboCop::Cop::InternalAffairs::NodeDestructuring

Checks that node destructuring is using the node extensions.

@example Using splat expansion

# bad
_receiver, method_name, _arguments = send_node.children

# bad
_receiver, method_name, _arguments = *send_node

# good
method_name = send_node.method_name

Constants

MSG

Public Instance Methods

on_masgn(node) click to toggle source
# File lib/rubocop/cop/internal_affairs/node_destructuring.rb, line 30
def on_masgn(node)
  node_destructuring?(node) do
    add_offense(node)
  end
end

Private Instance Methods

node_suffix?(method_name) click to toggle source
# File lib/rubocop/cop/internal_affairs/node_destructuring.rb, line 38
def node_suffix?(method_name)
  method_name.to_s.end_with?('node')
end