class RuboCop::AST::NodePattern::Node::Union

Node class for ‘{ … }`

def arity

def arity
  minima, maxima = map_min_max(children.map(&:arity_range)).transpose
  min = minima.min
  max = maxima.max
  min == max ? min : min..max
end

def in_sequence_head

def in_sequence_head
  return unless children.any?(&:in_sequence_head)
  new_children = children.map do |child|
    next child unless (replace = child.in_sequence_head)
    if replace.size > 1
      Subsequence.new(:subsequence, replace, loc: child.loc)
    else
      replace.first
    end
  end
  [with(children: new_children)]
end