Marc Heiler wrote: > Does this work with local variables too? > > For example, lets say I have a file called: > > foobar.rb > > Inside it we could have a class > > class Foo > def test > puts 'hi from class Foo' > end > end > > foo_object = Foo.new > > > Now, I would like to use this variable > foo_object > in another ruby file, or context. > > But as far as I know without eval this was not possible. > > Is this somehow possible with 'script'? (My brain is a bit confused > right now.) With 'script', you can only export constants and methods. So you could do this: FOO_OBJECT = Foo.new and then your main file can do this: my_script = Script.load("foobar.rb") p my_script::FOO_OBJECT Even though you are defining a constant, it is accessible only via the object assigned to my_script (the object is in fact a module), so you don't have to worry about namespace pollution. HTH... -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407