class YARD::RegistryResolver

def lookup_by_path(path, opts = {})

Other tags:
    Example: A lookup on a method through the inheritance tree -
    Example: A lookup from the A::B namespace -
    Example: A lookup from root -

Returns:
  • (CodeObjects::Base, CodeObjects::Proxy, nil) - the first object

Options Hash: (**opts)
  • type (Symbol) -- an optional type hint for the resolver
  • proxy_fallback (Boolean) -- when true, a proxy is returned
  • inheritance (Boolean) -- whether to perform lookups through
  • namespace (CodeObjects::Base, :root, nil) -- the namespace
def lookup_by_path(path, opts = {})
  path = path.to_s
  namespace = opts[:namespace]
  inheritance = opts[:inheritance] || false
  proxy_fallback = opts[:proxy_fallback] || false
  type = opts[:type]
  if namespace.is_a?(CodeObjects::Proxy)
    return proxy_fallback ? CodeObjects::Proxy.new(namespace, path, type) : nil
  end
  if namespace == :root || !namespace
    namespace = @registry.root
  else
    namespace = namespace.parent until namespace.is_a?(CodeObjects::NamespaceObject)
  end
  orignamespace = namespace
  if path =~ starts_with_default_separator_match
    path = $'
    namespace = @registry.root
    orignamespace = @registry.root
  end
  resolved = nil
  lexical_lookup = 0
  while namespace && !resolved
    resolved = lookup_path_direct(namespace, path, type)
    resolved ||= lookup_path_inherited(namespace, path, type) if inheritance
    break if resolved
    namespace = namespace.parent
    lexical_lookup += 1
  end
  # method objects cannot be resolved through lexical lookup by more than 1 ns
  if lexical_lookup > 1 && resolved.is_a?(CodeObjects::MethodObject)
    resolved = nil
  end
  if proxy_fallback
    resolved ||= CodeObjects::Proxy.new(orignamespace, path, type)
  end
  resolved
end