Method: YARD::CodeObjects::Base#path

Defined in:
lib/yard/code_objects/base.rb

#pathString Also known as: to_s

Represents the unique path of the object. The default implementation joins the path of #namespace with #name via the value of #sep. Custom code objects should ensure that the path is unique to the code object by either overriding #sep or this method.

Examples:

The path of an instance method

MethodObject.new(P("A::B"), :c).path # => "A::B#c"

Returns:

  • (String)

    the unique path of the object

See Also:



453
454
455
456
457
458
459
# File 'lib/yard/code_objects/base.rb', line 453

def path
  @path ||= if parent && !parent.root?
              [parent.path, name.to_s].join(sep)
            else
              name.to_s
            end
end