class ActionDispatch::Journey::GTG::Builder

def firstpos(node)

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

def firstpos: (ActionDispatch::Journey::Nodes::Literal node) -> Array[ActionDispatch::Journey::Nodes::Literal]

This signature was generated using 1 sample 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