From: Joel VanderWerf Date: 2006-10-29T04:37:35+09:00 Subject: Re: how to import variable from other .rb file? Joel VanderWerf wrote: ... > http://raa.ruby-lang.org/project/script/ > http://codeforpeople.com/lib/ruby/dynaload/ > > The first one (that's the one I wrote) doesn't let you grab local > variables from config.rb, but it does let you access constants > (including classes and modules) and methods defined in config.rb. The > constants and methods are wrapped up in a new module and you access them > through this module. This prevents namespace pollution. > > There's a simple example at: > > /home/vjoel/ruby/prj/script/doc/index.html Oops, I was browsing the local docs *blush* . Use this link instead: http://redshift.sourceforge.net/script/doc/index.html Here's one way to handle your config.rb file: $ cat config.rb def tool_mysql; 'X:/mysql.exe'; end TOOL_MYSQL = 'X:/mysql.exe' $ cat main.rb require 'script' config = Script.load "config.rb" puts config.tool_mysql puts config::TOOL_MYSQL $ ruby main.rb X:/mysql.exe X:/mysql.exe -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407