class ActionDispatch::Journey::GTG::Builder

def firstpos(node)

Experimental RBS support (using type sampling data from the type_fusion project).

type ActionDispatch__Journey__GTG__Builder_firstpos_node = ActionDispatch::Journey::Nodes::Cat | ActionDispatch::Journey::Nodes::Symbol | ActionDispatch::Journey::Nodes::Slash | ActionDispatch::Journey::Nodes::Literal

def firstpos: (ActionDispatch__Journey__GTG__Builder_firstpos_node node) -> (Array[ActionDispatch::Journey::Nodes::Symbol] | Array[ActionDispatch::Journey::Nodes::Slash] | Array[ActionDispatch::Journey::Nodes::Literal])

This signature was generated using 13 samples from 1 application.

def firstpos(node)
  case node
  when Nodes::Star
    firstpos(node.left)
  when Nodes::Cat
    if nullable?(node.left)
      firstpos(node.left) | firstpos(node.right)
    else
      firstpos(node.left)
    end
  when Nodes::Or
    node.children.flat_map { |c| firstpos(c) }.tap(&:uniq!)
  when Nodes::Unary
    firstpos(node.left)
  when Nodes::Terminal
    nullable?(node) ? [] : [node]
  else
    raise ArgumentError, "unknown firstpos: %s" % node.class.name
  end
end