开发者

What exactly is the :method: notation supposed to do for ruby docs?

Minitest has a bunch of methods defined like so:

  ##
  # :method: must_equal
  # See MiniTest::Assertions#assert_equal

  ##
  # :method: must_include
  # See MiniTest::Assertions#assert_includ开发者_运维问答es

  ##
  # :method: must_match
  # See MiniTest::Assertions#assert_match

  ##
  # :method: must_output
  # See MiniTest::Assertions#assert_output

These are defined in the Object module, so they're available on all objects. But why aren't they showing up in any docs? I've checked the docs generated by Yard on rdoc.info, and the ones generated by rdoc when I type gem rdoc minitest. They don't show up on either. How am I supposed to reference these if they don't show up anywhere? What is :method: supposed to do?


That looks like a way of documenting a method that doesn't get explicitly defined. There are occasions when you might want to add a note about a method that gets generated dynamically, for instance, or is loaded in from another module as is the case here.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜