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/
Regards,
Florian Gross