On Tue, 22 Apr 2003 nobu.nokada / softhome.net wrote:

> Hi,
>
> At Tue, 22 Apr 2003 01:08:52 +0900,
> ahoward wrote:
> > any ideas how to refer to the top level 'self' in a ruby program, that is to
> > say the self where self.to_s() == "main"
>
> eval "self", TOPLEVEL_BINDING

thanks!

so it would seem that

path = 'config.rb'
(eval("self", TOPLEVEL_BINDING)).instance_eval(IO.readlines(path, nil)[0])

is a reasonable way to pull in configuration info from pure ruby files.

of course, this cannot be placed into a method or stack local variable would
disapear.

i know this has been kicked around before - but i don't recall a nice clean
solution.

-a

--
  ====================================
  | Ara Howard
  | NOAA Forecast Systems Laboratory
  | Information and Technology Services
  | Data Systems Group
  | R/FST 325 Broadway
  | Boulder, CO 80305-3328
  | Email: ara.t.howard / fsl.noaa.gov
  | Phone:  303-497-7238
  | Fax:    303-497-7259
  ====================================