Error in MatchData docs

View: New views
5 Messages — Rating Filter:   Alert me  

Error in MatchData docs

by Ted Behling :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I wanted to point out an error I found in the documentation for the
MatchData class, visible at
http://ruby-doc.org/core/classes/MatchData.html .  Please advise if I
should post this elsewhere (such as a bug tracker).

Under the heading "mtch.captures => array", that page says:

    Returns the array of captures; equivalent to mtch.to_a.

However, that is demonstrably not the case, at least in Ruby 1.8.5.
MatchData#captures is different from MatchData#to_a in that to_a's first
element is the entire matched string, as in:

    irb(main):001:0> /(.)(.)(.)/.match('abc').captures
    => ["a", "b", "c"]
    irb(main):002:0> /(.)(.)(.)/.match('abc').to_a
    => ["abc", "a", "b", "c"]
    irb(main):003:0>

I suggest the verbage be changed to append the text "except that to_a
inserts the matched string as the first array element" after "equivalent
to mtch.to_a".

Ted Behling
ISP Systems Analyst, Hargray Communications
ted.behling@...



Re: Error in MatchData docs

by James Britt-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ted Behling wrote:
> Hello,
>
> I wanted to point out an error I found in the documentation for the
> MatchData class, visible at
> http://ruby-doc.org/core/classes/MatchData.html .  Please advise if I
> should post this elsewhere (such as a bug tracker).

The API docs are generated from comments in the Ruby source code.

The best way to handle this is to, ideally, post a patch to the ruby-doc
or ruby-core mailing lists for the code/comments in question.




Thanks,



James


Re: Error in MatchData docs

by Rich Morin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At 14:16 -0700 11/14/08, James Britt wrote:
> The API docs are generated from comments in the Ruby source code.
>
> The best way to handle this is to, ideally, post a patch to the
>  ruby-doc or ruby-core mailing lists for the code/comments in
>  question.

Actually, the best way to handle this would be to have a way for
the reader to make a comment, wiki-style, on the page, with an
alert being generated to interested parties...

-r
--
http://www.cfcl.com/rdm            Rich Morin
http://www.cfcl.com/rdm/resume     rdm@...
http://www.cfcl.com/rdm/weblog     +1 650-873-7841

Technical editing and writing, programming, and web development


Re: Error in MatchData docs

by Ryan Davis-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Nov 20, 2008, at 14:06 , Rich Morin wrote:

> At 14:16 -0700 11/14/08, James Britt wrote:
>> The API docs are generated from comments in the Ruby source code.
>>
>> The best way to handle this is to, ideally, post a patch to the
>> ruby-doc or ruby-core mailing lists for the code/comments in
>> question.
>
> Actually, the best way to handle this would be to have a way for
> the reader to make a comment, wiki-style, on the page, with an
> alert being generated to interested parties...

Actually, statements with "the best way" in them rarely are,  
especially if they start with "Actually".

In this case, the best way to actually get a change into the system is  
indeed to submit a patch to ruby-core. You're more than welcome to set  
up the system you're talking about. Until then it is simply pie-in-the-
sky.

Btw, LOVED YOU in Strange Brew!



Re: Error in MatchData docs

by Jeremy McAnally :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This system already exists and actually lets users edit the RDoc in
the browser and submit a patch to a remote Git repos.  It's called
docbox: http://github.com/iownbey/docbox

On Thu, Nov 20, 2008 at 9:59 PM, Ryan Davis <ryand-ruby@...> wrote:

>
> On Nov 20, 2008, at 14:06 , Rich Morin wrote:
>
>> At 14:16 -0700 11/14/08, James Britt wrote:
>>>
>>> The API docs are generated from comments in the Ruby source code.
>>>
>>> The best way to handle this is to, ideally, post a patch to the
>>> ruby-doc or ruby-core mailing lists for the code/comments in
>>> question.
>>
>> Actually, the best way to handle this would be to have a way for
>> the reader to make a comment, wiki-style, on the page, with an
>> alert being generated to interested parties...
>
> Actually, statements with "the best way" in them rarely are, especially if
> they start with "Actually".
>
> In this case, the best way to actually get a change into the system is
> indeed to submit a patch to ruby-core. You're more than welcome to set up
> the system you're talking about. Until then it is simply pie-in-the-sky.
>
> Btw, LOVED YOU in Strange Brew!
>
>
>



--
http://jeremymcanally.com/
http://entp.com/
http://omgbloglol.com

My books:
http://manning.com/mcanally/
http://humblelittlerubybook.com/ (FREE!)