# # This creates a Regexp which will match 3 "foo"s.
# re = Regexp::English.literal("foo" * 3)
# re.match("foofoofoo")[0] # => "foofoofoo"
many times, I have multi-# on a line on my code. Blame me lazy and my editor
is it possible to put (Example) tags? =)
# #Example: This creates a Regexp which will match 3 "foo"s.
# re = Regexp::English.literal("foo" * 3)
# re.match("foofoofoo")[0] # => "foofoofoo"
# #EndExample <-- this would be optional if it hits another #Example
> # # This creates a Regexp which will match 3 "foo"s.
> # re = Regexp::English.literal("foo" * 3)
> # re.match("foofoofoo")[0] # => "foofoofoo"
many times, I have multi-# on a line on my code. Blame me lazy and my
editor
At least you write comments! Me the L:)
is it possible to put (Example) tags? =)
# #Example: This creates a Regexp which will match 3 "foo"s.
# re = Regexp::English.literal("foo" * 3)
# re.match("foofoofoo")[0] # => "foofoofoo"
# #EndExample <-- this would be optional if it hits another #Example
indents not needed of course.
In that case there is always markup:
# <example>
# # This creates a Regexp which will match 3 "foo"s.
# re = Regexp::English.literal("foo" * 3)
# re.match("foofoofoo")[0] # => "foofoofoo"
# </example>
But has any one considered YAML? I find myself using YAML style in my comments
sometimes (I use YAML lots) then have to go back and adjust for RDoc.
# - !example |
# # This creates a Regexp which will match 3 "foo"s.
# re = Regexp::English.literal("foo" * 3)
# re.match("foofoofoo")[0] # => "foofoofoo"
But perhaps too restrictive.
T.
···
On Wednesday 20 October 2004 12:07 am, "Peña, Botp" wrote:
# # This creates a Regexp which will match 3 "foo"s.
# re = Regexp::English.literal("foo" * 3)
# re.match("foofoofoo")[0] # => "foofoofoo"
many times, I have multi-# on a line on my code. Blame me lazy and my editor
Which is not explicitly bad. But do you also have indented text in your RDoc documentation? test-extract only looks for sample code in RDoc documentation which is comments that are directly before a method or class definition like this:
# Here goes the documentation.
# Here goes the sample code.
def foo; end
But not like this:
def foo
# Just a random comment.
# With something random that is indented.
end
is it possible to put (Example) tags? =)
# #Example: This creates a Regexp which will match 3 "foo"s.
# re = Regexp::English.literal("foo" * 3)
# re.match("foofoofoo")[0] # => "foofoofoo"
# #EndExample <-- this would be optional if it hits another #Example
See above. Is this really necessary? If I add support for this then I will need to remove the current rule which is less restrictive.
If we really need such a rule I think I would change it so that it would match anything that is indented and preceded by optional empty lines and one of the words "example", "sample", "code".
That would still allow you to write:
# This method doubles an object. The object has to respond to +*+.
# It is used like in this example: