开发者

linking to a method by the same name in a different class (Rdoc)

I'm documenting some ruby code right now. We have two classes that both have a method called "host".

In one of these classes the method needs some special comments. In the other class I'd like to refer to the first class, and have that reference be a link to it.

Normally in rdoc, typing the name of a method is enough to generate a link. In this case, even if I write out Class::SubClass.host the link still insists on pointing to the method in the current class.

Any rdoc masters out there know how to do this?

Here is an example in FakeTown::Api where I want to link to RealTown::Api's method #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 s开发者_高级运维ame name which directly references RealTown::Api#url
def host
  uri = URI.parse url
  uri.host
end

The link produced by rdoc unhelpfully links right back to the #host method in this document.

Thanks!


You probably want to link to the instance method, not the class method. Class::SubClass#host should work.

The following example does, what you are describing.

class A
  # first method
  def a
  end
end

class B
  # second method linking to A#a
  def a
  end
end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜