From: Alex Gutteridge Date: 2007-09-07T14:27:40+09:00 Subject: Re: Equivalent of "source" in ruby? On 7 Sep 2007, at 14:17, Todd A. Jacobs wrote: > Contrary to my expectations, if I have some variable assignments in an > external file, I can't simply call: > > load rcfile > > to have it sourced. Instead, I found myself having to do this: > > IO.foreach(rcfile) do |line| > eval line > end > > which seems lame. Is there a better way? Would globals work for you? [alexg@powerbook]/Users/alexg/Desktop(28): cat load_me.rb $global=10 local=20 [alexg@powerbook]/Users/alexg/Desktop(29): cat main.rb load 'load_me.rb' puts $global puts local [alexg@powerbook]/Users/alexg/Desktop(30): ruby main.rb 10 main.rb:4: undefined local variable or method `local' for main:Object (NameError) Alex Gutteridge Bioinformatics Center Kyoto University