"Mike Wilson" <wmwilson01 / hotmail.com> schrieb im Newsbeitrag
news:Law12-F50uCVPPvkBhz00001bcc / hotmail.com...
> >From: "John W. Long" <ws / johnwlong.com>
> >Reply-To: ruby-talk / ruby-lang.org
> >To: ruby-talk / ruby-lang.org (ruby-talk ML)
> >Subject: Configuration Files
> >Date: Thu, 18 Dec 2003 13:01:10 +0900
> >
> >A while back someone submitted some code to this list for evaluating
> >Configuration files in the style of:
> >
> >% cat test.config
> >editor.spacespertab = 4
> >toolbar.visible = true
> >statusbar.visible = false
> >. . .
> >
> >One of the great things about their code was that it enabled you to use
> >ruby
> >code within your configuration file so you could do things like this
> >
>
> Doesn't this have some security implications?  I'm not really sure that I
> can think of any applications that you'd want to let a user configure, but
> that runs as root, but if there was one, I wouldn't want to be evaling
code
> from the config.  As I said, I'm not sure this is a valid concern on my
> part, just more of a thought.  Could it maybe be configurable from the
app?
> eval = true; if eval ...

You can use $SAVE and / or an anonymous module, like Nobu wrote on
26.1.2003:

Kernel#load code in the file into toplevel context if (omitted)
second argument is false, or an anonymous module.

If it were return that anonymous module, you can write as:

  module Data
    include load("datafile", true)
  end

or even

  Data = load("datafile", true)

    robert