Question

In one file I have

module Adapter
  ##
  # :method: avatar

  ##
  # :method: avatar=(value)
end

In another file I want to have links to these methods:

# Adapter#avatar         # this generates a valid link to another page
# Adapter#avatar=        # this is shown as raw text

How to tell rdoc that it should generate the second link?

Update: it's confirmed that if the writer is defined statically with def avatar=(value); end, the link is generated okay. Dynamic writer though is apparently bugged.

Update2: Okay, it's not about the link. It's about generating right name of the writer method:

module Adapter
  ##
  # :method: avatar=(value)
end

generated doc with avatar=(value)() name, and

module Adapter
  def avatar=(value); end
end

generates correct avatar=(value) doc which gets linked.

Was it helpful?

Solution

You should declare your parameters using :call-seq:, and not include your parameter list in the :method: line. The following works for me, and all the links work:

module Adapter
  ##
  # :method: avatar

  ##
  # :method: avatar=
  #
  # :call-seq: avatar=(value)
end

# See Adapter#avatar  
# See Adapter#avatar=
#
class Linked
end

:method: declares the name of the method, and :call-seq: declares the parameter signature it accepts.

(And BTW, I found some very helpful documentation on RDoc syntax here).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top