Tag Archives: irb

Bunny: Ruby IRB auto-completion issue

It was brought to my attention by Sho Fukamachi that a repeatable error occurs when trying to use IRB auto-completion with Bunny in some versions of Ruby 1.8.6 and 1.8.7. The problem does not occur in Ruby 1.9.1 and seems to have been fixed in Ruby 1.8.6 p287.

In your IRB session, if you see something like the following  –

q.me/Users/chrisduncan/ruby186/lib/ruby/1.8/irb/completion.rb:159: can't convert Symbol
into String (TypeError) ...

It appears to be a bug in irb/completion.rb. I applied the following patch to fix it –

Change the line:

/^(IRB|SLex|RubyLex|RubyToken)/ =~ name


/^(IRB|SLex|RubyLex|RubyToken)/ =~ name.to_s

Personally, I would advise installing an officially patched version of Ruby to remedy the issue. However, as always, the choice is yours.

Update (21/07/2011)

As a result of further investigation there is a remedy to this issue that has been implemented in Bunny. It will be included in the next release of the gem, however, if you need to get a patched version more quickly, both the 0.7.x-stable and master branches on GitHub include the patch.