# Return values in rdoc method header

**URL:** <https://www.ruby-forum.com/t/return-values-in-rdoc-method-header/178057>\
**Category:** Ruby\
**Created:** [October 28, 2009, 4:43pm UTC](https://www.ruby-forum.com/t/return-values-in-rdoc-method-header/178057 "2009-10-28T16:43:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![leveille](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a88e57/32.png) [@leveille](https://www.ruby-forum.com/u/leveille)\
**Post date:** [October 28, 2009, 4:43pm UTC](https://www.ruby-forum.com/t/return-values-in-rdoc-method-header/178057/1 "2009-10-28T16:43:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![leveille](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a88e57/32.png) [@leveille](https://www.ruby-forum.com/u/leveille)\
**Post date:** [October 28, 2009, 7:14pm UTC](https://www.ruby-forum.com/t/return-values-in-rdoc-method-header/178057/2 "2009-10-28T19:14:08Z")

</div>

Jason L. 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

---

<div class="post-metadata">

**Author:** ![leveille](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a88e57/32.png) [@leveille](https://www.ruby-forum.com/u/leveille)\
**Post date:** [October 28, 2009, 7:51pm UTC](https://www.ruby-forum.com/t/return-values-in-rdoc-method-header/178057/3 "2009-10-28T19:51:04Z")

</div>

Marvin GÃ¼lker wrote:

> #call-seq:

Thank you. I have not yet found that in the documentation, but that  
answers my question.
