Created
May 1, 2011 10:11
-
-
Save richardkmichael/950389 to your computer and use it in GitHub Desktop.
Loading local variables into an IRB session: matz vs. rbx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat foo.rb | |
s = 'foo' | |
ruby-1.9.2-p180 :008 > eval File.read('foo.rb') | |
=> "foo" | |
ruby-1.9.2-p180 :009 > s | |
NameError: undefined local variable or method `s' for main:Object | |
from (irb):9 | |
from /Users/rmichael/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>' | |
rbx-1.2.3-20110315 :002 > eval File.read('foo.rb') | |
=> "foo" | |
rbx-1.2.3-20110315 :003 > s | |
=> "foo" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
AFAICT, Matz answered here about this. This one of the reason why in a recent project (you know which one :)) I replaced the
eval
's by simpleYAML.load
's.