A reference to a method with the same name in another class (Rdoc)

I am documenting ruby ​​code right now. We have two classes that have a method called "host".

In one of these classes, the method needs special comments. In another class, I would like to refer to the first class, and this link will be a link to it.

Usually in rdoc to enter a link, just enter the name of the method. In this case, even if I write Class::SubClass.host, the link still insists on pointing to the method in the current class.

Any rdoc wizards know how to do this?

Here is an example in FakeTown::Apiwhere I want to reference a method RealTown::Api #host:

# Returns the host as defined in config.yml under the heading "url".
# 
# It appears as though this method is no longer in use, as
# features/support/vcr_config.rb contains its own method
# by the same name which directly references RealTown::Api#url
def host
  uri = URI.parse url
  uri.host
end

The link created by rdoc is uselessly associated with the method #hostin this document.

Thank!

+3
source share
1 answer

You probably want to bind an instance method, not a class method. Class::SubClass#hostmust work.

The following example shows what you are describing.

class A
  # first method
  def a
  end
end

class B
  # second method linking to A#a
  def a
  end
end
+2
source

All Articles