Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > return values in rdoc method header

Reply
Thread Tools

return values in rdoc method header

 
 
Jason Lillywhite
Guest
Posts: n/a
 
      10-28-2009
The rdoc heading for Array[index] method says:

array[index] = obj → obj

and for String.new:

String.new(str="") => new_str

When I document my own classes, how do I make the part that shows return
values with the arrow appear? i.e. change_array(old_array) => new_array

I don't know how to comment my code such that the "=> new_array" would
appear in rdoc.

Thank you.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Marvin Gülker
Guest
Posts: n/a
 
      10-28-2009
Jason Lillywhite wrote:
> The rdoc heading for Array[index] method says:
>
> array[index] = obj → obj
>
> and for String.new:
>
> String.new(str="") => new_str
>
> When I document my own classes, how do I make the part that shows return
> values with the arrow appear? i.e. change_array(old_array) => new_array
>
> I don't know how to comment my code such that the "=> new_array" would
> appear in rdoc.
>
> Thank you.


You have to use the call-seq directive for that:
-----------------------

#call-seq:
# my_method(str) ==> aString
# my_method(str, true) ==> anInteger
#
#This is your normal method description.
def my_method(x, y = false)
#Here goes your code...
end

-------------------------
Note the empty line between the method description header and the main
description.

Marvin
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Jason Lillywhite
Guest
Posts: n/a
 
      10-28-2009
Marvin Gülker wrote:

> #call-seq:



Thank you. I have not yet found that in the documentation, but that
answers my question.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RDoc: How to link to a method description from other rdoc page? Iñaki Baz Castillo Ruby 3 07-28-2009 09:03 PM
Header files with "header.h" or <header.h> ?? mlt C++ 2 01-31-2009 02:54 PM
rdoc bug (and rdoc bug tracker site is down) Brian Schrder Ruby 5 09-18-2004 02:08 PM
Previous return values from a BE method are shown when refreshing an ASP calling that method Shekhar ASP General 0 07-16-2004 03:59 AM
rdoc: how to generate rdoc & ri documentation of standard library? Andreas Schwarz Ruby 6 01-01-2004 03:09 AM



Advertisments