class ActionDispatch::Journey::GTG::Builder

def lastpos(node)

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

type ActionDispatch__Journey__GTG__Builder_lastpos_node = ActionDispatch::Journey::Nodes::Cat | ActionDispatch::Journey::Nodes::Literal | ActionDispatch::Journey::Nodes::Dot | ActionDispatch::Journey::Nodes::Slash | ActionDispatch::Journey::Nodes::Group | ActionDispatch::Journey::Nodes::Symbol | ActionDispatch::Journey::Nodes::Star
type ActionDispatch__Journey__GTG__Builder_lastpos_return_value = Array[ActionDispatch::Journey::Nodes::Symbol] | Array[ActionDispatch::Journey::Nodes::Literal] | Array[ActionDispatch::Journey::Nodes::Slash] | Array[ActionDispatch::Journey::Nodes::Dot]

def lastpos: (ActionDispatch__Journey__GTG__Builder_lastpos_node node) -> ActionDispatch__Journey__GTG__Builder_lastpos_return_value

This signature was generated using 207 samples from 3 applications.

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