From: Minkoo Seo Date: 2006-07-01T11:10:55+09:00 Subject: Differences between irb and ruby. ------=_Part_5840_15974232.1151719852300 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi list. I've recently learned that irb and ruby (ruby interpreter) behave differently often and that irb is not running on ruby interpreter. As an example, [mkseo@uranus src]$ irb irb(main):001:0> def foo irb(main):002:1> puts "foo" irb(main):003:1> end => nil irb(main):004:0> class Bar; end => nil irb(main):005:0> Bar.new.foo foo => nil irb(main):006:0> quit irb let me call foo which is non-sense. [mkseo@uranus src]$ cat > test.rb def foo puts "foo" end class Bar; end Bar.new.foo [mkseo@uranus src]$ ruby test.rb test.rb:5: private method `foo' called for # (NoMethodError) [mkseo@uranus src]$ Ruby interpreter fails as expected. So, here's my question. Why is irb running on its own interpreter(or simulator or whatever)? Sincerely, Minkoo Seo ------=_Part_5840_15974232.1151719852300--