trans. (T. Onoma) wrote: > On Tuesday 19 October 2004 03:19 pm, Florian Gross wrote: > | gabriele renzi wrote: > | > Mauricio Fernández ha scritto: > | >> Look carefully at the example: > | >> > | >> # # This creates a Regexp which will match 3 "foo"s. > | >> # re = Regexp::English.literal("foo" * 3) > | >> # re.match("foofoofoo")[0] # => "foofoofoo" > | > > | > sidenote: I'd prefer to see this done like: > | > # This creates a Regexp which will match 3 "foo"s. > | > # irbprompt>somecode > | > # =>someresult > | > # irbprompt>somemore > | > # =>someother > | > | I think the latter is harder to read, because there is more clutter, > | though in theory that style could also be supported by test-extract. > | > | Maybe I can add it later if there is enough demand for it. > > Actually goes with your '# outputs ...' notation if you use '# => ...' > instead. > > # This creates a Regexp which will match 3 "foo"s. > # irbprompt>somecode # =>someresult > # irbprompt>somemore # =>someother > > And I see no good reason to keep the irb prompt so... > > # This creates a Regexp which will match 3 "foo"s. > # somecode # =>someresult > # somemore # =>someother > > Fairly simple transformation from irb. Isn't that what we already had above, but with the indentation removed? :) The indentation also makes RDoc display the text in a fixed-width font suitable for code BTW. If the comment had been done without the leading "# " it would not appear to be part of the example, but of the documentation above it. Regards, Florian Gross