source code comments

D

Dirk Einecke

Hi.

Is there any standard way to comment ruby-code (for example description
and author for a method or class)?

greetings
Dirk Einecke
 
F

Florian Gross

Dirk said:
Hi.
Moin!

Is there any standard way to comment ruby-code (for example description
and author for a method or class)?

RDoc seems to be what the community agrees on right now. I'm using it
like this:

# Creates a Regexp which matches either this Regexp
# or the Regexp specified as the argument.
#
# re = Regexp::English.new do
# literal("foo") | literal("bar")
# end
# re.match("foo")[0] # => "foo"
# re.match("bar")[0] # => "bar"
#
# There's a small optimization that is done all the
# time: If you +or+ a Node with itself you won't get
# a Variant; instead you will get the same Node back
# again. An example:
#
# re = Regexp::English.literal("foo")
# re | re == re # => true
def |(other)
if self == other
self
else
Variant.new(self, other)
end
end

You'll find more information about RDoc at http://rdoc.sourceforge.net/
greetings
Dirk Einecke

Regards,
Florian Gross
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,826
Members
47,371
Latest member
Brkaa

Latest Threads

Top