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::Dot | ActionDispatch::Journey::Nodes::Symbol | ActionDispatch::Journey::Nodes::Group | ActionDispatch::Journey::Nodes::Slash | ActionDispatch::Journey::Nodes::Cat | ActionDispatch::Journey::Nodes::Dummy | ActionDispatch::Journey::Nodes::Literal
type ActionDispatch__Journey__GTG__Builder_firstpos_return_value = Array[ActionDispatch::Journey::Nodes::Symbol] | Array[ActionDispatch::Journey::Nodes::Slash] | Array[ActionDispatch::Journey::Nodes::Literal] | Array[ActionDispatch::Journey::Nodes::Dummy] | Array[ActionDispatch::Journey::Nodes::Dot]

def firstpos: (ActionDispatch__Journey__GTG__Builder_firstpos_node node) -> ActionDispatch__Journey__GTG__Builder_firstpos_return_value

This signature was generated using 194 samples from 3 applications.

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