Class: RuboCop::AST::NodePattern::Node::Capture

Inherits:
RuboCop::AST::NodePattern::Node show all
Defined in:
lib/rubocop/ast/node_pattern/node.rb

Overview

Node class for `$something`

Constant Summary

Constants inherited from RuboCop::AST::NodePattern::Node

FunctionCall, MAP

Instance Method Summary collapse

Methods inherited from RuboCop::AST::NodePattern::Node

#arity, #arity_range, #child, #children_nodes, #matches_within_set?, #rest?, #variadic?, #with

Methods included from Descendence

#child_nodes, #descendants, #each_child_node, #each_descendant, #each_node

Instance Method Details

#capture?Boolean

Returns:

  • (Boolean)

97
98
99
# File 'lib/rubocop/ast/node_pattern/node.rb', line 97

def capture?
  true
end

#in_sequence_headObject


105
106
107
108
109
110
# File 'lib/rubocop/ast/node_pattern/node.rb', line 105

def in_sequence_head
  wildcard, original_child = child.in_sequence_head
  return unless original_child

  [wildcard, self] # ($...) => (_ $...)
end

#nb_capturesObject


101
102
103
# File 'lib/rubocop/ast/node_pattern/node.rb', line 101

def nb_captures
  1 + super
end