Class: RuboCop::AST::NodePattern::Node::Sequence
- Inherits:
-
RuboCop::AST::NodePattern::Node
- Object
- Parser::AST::Node
- RuboCop::AST::NodePattern::Node
- RuboCop::AST::NodePattern::Node::Sequence
- Includes:
- ForbidInSeqHead
- Defined in:
- lib/rubocop/ast/node_pattern/node.rb
Overview
Node class for ‘(type first second …)`
Constant Summary
Constants inherited from RuboCop::AST::NodePattern::Node
Instance Method Summary collapse
-
#initialize(type, children = [], properties = {}) ⇒ Sequence
constructor
A new instance of Sequence.
Methods included from ForbidInSeqHead
Methods inherited from RuboCop::AST::NodePattern::Node
#arity, #arity_range, #capture?, #child, #children_nodes, #in_sequence_head, #matches_within_set?, #nb_captures, #rest?, #variadic?, #with
Methods included from Descendence
#child_nodes, #descendants, #each_child_node, #each_descendant, #each_node
Constructor Details
#initialize(type, children = [], properties = {}) ⇒ Sequence
Returns a new instance of Sequence.
117 118 119 120 121 122 123 |
# File 'lib/rubocop/ast/node_pattern/node.rb', line 117 def initialize(type, children = [], properties = {}) if (replace = children.first.in_sequence_head) children = [*replace, *children[1..-1]] end super end |