"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:inname_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:indisplay_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:indisplay_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:indisplay_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:inrun’
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.

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

/Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:1001:
from
`display_names’
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.

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

Hint: https://github.com/rdoc/rdoc/issues