brice exits irb when accessing undefined variable
dayglojesus opened this issue · comments
When loading brice via .irbrc, any attempt to access an undefined variable forces irb to close.
Ruby Verison: ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
Example (when using brice):
[20:09:50] bcw$ irb
irb(main):001:0> x
[20:10:42] bcw$
Example (not using brice):
[20:10:42] bcw$ irb -f
irb(main):001:0> x
NameError: undefined local variable or method `x' for main:Object
from (irb):1
from /usr/bin/irb:12:in `<main>'
irb(main):002:0>
that's hardly any variable, don't you think? x
is an alias for exit
.
if you don't want those shortcuts at all, exclude them in your .irbrc
:
require 'brice'
Brice.init { |config| config.exclude 'shortcuts' }
if you don't want that particular shortcut, just remove it:
require 'brice/init'
Brice::Shortcuts::ObjectShortcuts.send(:remove_method, :x)
cheers
jens
Ugh, I had no idea, sorry.
Still why bother making an alias for exit when there's already ^D.
easier to type? for me, it boils down to muscle memory by now - and it prevents me from accidentally closing my shell session. YMMV, of course.