class RuboCop::AST::NodePattern::Node::Subsequence

A list (potentially empty) of nodes; part of a Union

Public Instance Methods

arity() click to toggle source
# File lib/rubocop/ast/node_pattern/node.rb, line 205
def arity
  min, max = children.map(&:arity_range).map(&:minmax).transpose.map(&:sum)
  min == max ? min || 0 : min..max # NOTE: || 0 for empty case, where min == max == nil.
end
in_sequence_head() click to toggle source
# File lib/rubocop/ast/node_pattern/node.rb, line 210
def in_sequence_head
  super if children.empty?

  return unless (replace = children.first.in_sequence_head)

  [with(children: [*replace, *children[1..-1]])]
end