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 =~ /\A#{default_separator}/
path, namespace = $', @registry.root
end
resolved = nil
while namespace && !resolved
resolved = lookup_path_direct(namespace, path, type)
resolved ||= lookup_path_inherited(namespace, path, type) if inheritance
namespace = namespace.parent
end
if proxy_fallback
resolved ||= CodeObjects::Proxy.new(orignamespace, path, type)
end
resolved
end