irb terminates with no method error
When I input the following lines in irb, the irb terminates.
$ irb irb(main):001:0> def !; end => :! irb(main):002:0> ! /usr/local/lib/ruby/2.1.0/irb/input-method.rb:153:in `gets': private method `!' called for false:FalseClass (NoMethodError) ... $
A corresponding question is posted on StackOverflow at http://stackoverflow.com/questions/25572126/irb-terminates-with-no-method-error/25572313#25572313.
Updated by shevegen (Robert A. Heiler) about 5 years ago
Indeed. I have a similar error but different:
def !; end # => :!
rc_file': private method!' called for #Proc:0x00000001a19338@/usr/lib/ruby/2.1.0/irb/init.rb:273 (NoMethodError)
Somehow a Proc is called in my case. This happens when I type an empty newline after inputting the above code.
Updated by jeremyevans0 (Jeremy Evans) 4 months ago
- Status changed from Open to Closed
This was fixed between Ruby 2.2 and 2.3:
$ irb22 irb(main):001:0> def !; end => :! irb(main):002:0> ! /usr/local/lib/ruby/2.2/irb/input-method.rb:151:in `gets': private method `!' called for false:FalseClass (NoMethodError) from /usr/local/lib/ruby/2.2/irb.rb:469:in `block (2 levels) in eval_input' from /usr/local/lib/ruby/2.2/irb.rb:623:in `signal_status' from /usr/local/lib/ruby/2.2/irb.rb:468:in `block in eval_input' from /usr/local/lib/ruby/2.2/irb/ruby-lex.rb:188:in `call' from /usr/local/lib/ruby/2.2/irb/ruby-lex.rb:188:in `buf_input' from /usr/local/lib/ruby/2.2/irb/ruby-lex.rb:103:in `getc' from /usr/local/lib/ruby/2.2/irb/slex.rb:205:in `match_io' from /usr/local/lib/ruby/2.2/irb/slex.rb:75:in `match' from /usr/local/lib/ruby/2.2/irb/ruby-lex.rb:282:in `token' from /usr/local/lib/ruby/2.2/irb/ruby-lex.rb:264:in `lex' from /usr/local/lib/ruby/2.2/irb/ruby-lex.rb:235:in `block (2 levels) in each_top_level_statement' from /usr/local/lib/ruby/2.2/irb/ruby-lex.rb:231:in `loop' from /usr/local/lib/ruby/2.2/irb/ruby-lex.rb:231:in `block in each_top_level_statement' from /usr/local/lib/ruby/2.2/irb/ruby-lex.rb:230:in `catch' from /usr/local/lib/ruby/2.2/irb/ruby-lex.rb:230:in `each_top_level_statement' from /usr/local/lib/ruby/2.2/irb.rb:485:in `eval_input' from /usr/local/lib/ruby/2.2/irb.rb:395:in `block in start' from /usr/local/lib/ruby/2.2/irb.rb:394:in `catch' from /usr/local/lib/ruby/2.2/irb.rb:394:in `start' from /usr/local/bin/irb22:11:in `<main>' $ irb23 irb(main):001:0> def !; end => :! irb(main):002:0> ! irb(main):003:0* nil irb(main):004:0> => nil irb(main):004:0>