"ri 'Array.[]'" fails

The ri --help says:

Note that shell quoting or escaping may be required for method names
containing punctuation:

    ri 'Array.'

Okay, so let's try it:

jansen:~ mattleopard$ ri 'Array.'
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:1001:
warning: character class has `]' without escape
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:1001:in
`name_regexp': premature end of regular expression: /^Array(#|::)$/
(RegexpError)
        from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:762:in
`filter_methods'
        from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:654:in
`display_method'
        from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:695:in
`display_name'
        from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:720:in
`display_names'
        from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:717:in
`each'
        from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:717:in
`display_names'
        from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:1072:in
`run'
        from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:317:in
`run'
        from /Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/bin/ri:5
        from /usr/bin/ri:19:in `load'
        from /usr/bin/ri:19

My guess is that ri is trying to be clever with some sort of regex
guesswork in case I get the command wrong, but is getting hoist on its
own petard. m.

···

--
matt neuburg, phd = matt@tidbits.com <http://www.tidbits.com/matt/&gt;
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
Matt Neuburg’s Home Page

You should file a bug if you think this is a bug in RDoc.

Hint: Pull requests · rdoc/rdoc · GitHub

···

On Mar 1, 2011, at 5:59 PM, Matt Neuburg wrote:

The ri --help says:

Note that shell quoting or escaping may be required for method names
containing punctuation:

   ri 'Array.'

Okay, so let's try it:

jansen:~ mattleopard$ ri 'Array.'
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:1001:
warning: character class has `]' without escape
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:1001:in
`name_regexp': premature end of regular expression: /^Array(#|::)$/
(RegexpError)
       from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:762:in
`filter_methods'
       from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:654:in
`display_method'
       from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:695:in
`display_name'
       from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:720:in
`display_names'
       from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:717:in
`each'
       from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:717:in
`display_names'
       from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:1072:in
`run'
       from
/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:317:in
`run'
       from /Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/bin/ri:5
       from /usr/bin/ri:19:in `load'
       from /usr/bin/ri:19

My guess is that ri is trying to be clever with some sort of regex
guesswork in case I get the command wrong, but is getting hoist on its
own petard. m.