Class: RuboCop::AST::NodePattern::Node::AnyOrder
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::RuboCop::AST::NodePattern::Node ,
::RuboCop::SimpleForwardable ,
Parser::AST::Node
|
|
Instance Chain:
self,
ForbidInSeqHead ,
::RuboCop::AST::NodePattern::Node ,
::RuboCop::AST::Descendence ,
Parser::AST::Node
|
|
Inherits: |
RuboCop::AST::NodePattern::Node
|
Defined in: | lib/rubocop/ast/node_pattern/node.rb |
Overview
Node class for <int str …>
Constant Summary
-
ARITIES =
private
# File 'lib/rubocop/ast/node_pattern/node.rb', line 182Hash.new { |h, k| h[k] = (k - 1)..Float::INFINITY }
::RuboCop::AST::NodePattern::Node
- Inherited
Class Method Summary
::RuboCop::SimpleForwardable
- Extended
Instance Attribute Summary
- #ends_with_rest? ⇒ Boolean readonly
::RuboCop::AST::NodePattern::Node
- Inherited
#capture?, | |
#matches_within_set? | that matches within a Set (e.g. |
#rest? | To be overridden by subclasses. |
#variadic? |
Instance Method Summary
ForbidInSeqHead
- Included
::RuboCop::AST::NodePattern::Node
- Inherited
#arity | Note: |
#arity_range, #child, #children_nodes, #in_sequence_head, #nb_captures, #source_range, #with |
::RuboCop::AST::Descendence
- Included
#child_nodes | Returns an array of child nodes. |
#descendants | Returns an array of descendant nodes. |
#each_child_node | Calls the given block for each child node. |
#each_descendant | Calls the given block for each descendant node with depth first order. |
#each_node | Calls the given block for the receiver and each descendant node in depth-first order. |
Instance Attribute Details
#ends_with_rest? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/rubocop/ast/node_pattern/node.rb', line 189
def ends_with_rest? children.last.rest? end
Instance Method Details
#arity
[ GitHub ]# File 'lib/rubocop/ast/node_pattern/node.rb', line 197
def arity return children.size unless ends_with_rest? ARITIES[children.size] end
#rest_node
[ GitHub ]# File 'lib/rubocop/ast/node_pattern/node.rb', line 193
def rest_node children.last if ends_with_rest? end
#term_nodes
[ GitHub ]# File 'lib/rubocop/ast/node_pattern/node.rb', line 185
def term_nodes ends_with_rest? ? children[0...-1] : children end