5

When I paste this code in irb prompt I get listing of current directory after line if true.

def some_method()

  if true
        raise StandardError
    end

end

Example of output:

irb(main):151:0> def some_method()
irb(main):152:1> 
irb(main):153:1*   if true
irb(main):154:2> 
.Skype/                          .m2/                             Desktop/
...

I use irb 0.9.5(05/04/13) and ruby 1.8.7 (2011-12-28 patchlevel 357).

Is this a bug, or something else?

XoR
  • 2,556
  • 4
  • 17
  • 15

2 Answers2

4

The following line will have tab characters in it:

        raise StandardError

irb uses readline which means that the tab key is used for tab completion. Double tab will show you all the available options.

To see this in action, just launch irb and hit the tab key twice.

See https://superuser.com/questions/37148/how-to-disable-double-tab-to-show-available-commands-in-linux-console for guidance on how to disable it.

Community
  • 1
  • 1
Don Cruickshank
  • 5,641
  • 6
  • 48
  • 48
1

Because of the reason Don Cruickshanks mentioned, you should set the option to convert tabs to spaces in your text editor.