Class YARD::CodeObjects::Proxy
In: lib/yard/code_objects/proxy.rb
Parent: Object

The Proxy class is a way to lazily resolve code objects in cases where the object may not yet exist. A proxy simply stores an unresolved path until a method is called on the object, at which point it does a lookup using {Registry.resolve}. If the object is not found, a warning is raised and {ProxyMethodError} might be raised.

@example Creates a Proxy to the String class from a module

  # When the String class is parsed this method will
  # begin to act like the String ClassObject.
  Proxy.new(mymoduleobj, "String")

@see Registry.resolve @see ProxyMethodError

Methods

<=>   ==   ===   ===   class   equal?   hash   inspect   instance_of?   is_a?   kind_of?   method_missing   name   new   path   respond_to?   root?   to_s   to_str   type   type=  

External Aliases

namespace -> parent

Attributes

namespace  [R] 

Public Class methods

Creates a new Proxy

@raise [ArgumentError] if namespace is not a NamespaceObject @return [Proxy] self

Public Instance methods

@return [Boolean]

==(other)

Alias for equal?

@return [Boolean]

Returns the class name of the object the proxy is mimicking, if resolved. Otherwise returns Proxy. @return [Class] the resolved object‘s class or Proxy

@return [Boolean]

@return [Integer] the object‘s hash value (for equality checking)

Returns a text representation of the Proxy @return [String] the object‘s inspect method or P(OBJECTPATH)

@return [Boolean]

@return [Boolean]

@return [Boolean]

Dispatches the method to the resolved object.

@raise [ProxyMethodError] if the proxy cannot find the real object

If the proxy resolves to an object, returns its path, otherwise guesses at the correct path using the original namespace and name.

@return [String] the assumed path of the proxy (or the real path

  of the resolved object)

This class is never a root object

to_s()

Alias for path

to_str()

Alias for path

Returns the type of the proxy. If it cannot be resolved at the time of the call, it will either return the inferred proxy type (see {type=}) or +:proxy+ @return [Symbol] the Proxy‘s type @see type=

Allows a parser to infer the type of the proxy by its path. @param [to_sym] type the proxy‘s inferred type @return [void]

[Validate]