On Nov 8, 9:30 pm, "ara.t.howard" <ara.t.how... / gmail.com> wrote:

> cfp:~ > cat a.rb
> require "attributes" ### gem install attributes
>
> class Config
>    attribute "width"
>    attribute "height"
>    attribute "color"
>    # ...
> end
>
> cfp:~ > cat b.rb
> configure {
>    width 42
>
>    height 42.0
>
>    color "pinky-beige"
> }
>
> it's true that they are not local vars but i think the effect is
> useful enough.

Thanks for the response.  Actually I previously abandoned this kind of
setup because it was inconsistent with the rest of my rakefile.  I
don't want a clear distinction between config variables and regular
variables --- in fact, the blurrier the better.  If I decide to move
one variable into the config section, there should be no associated
code changes.

One solution is to put all my variables in that config class,
whereupon I would call it class Stuff.  But then the rakefile is
messier and harder to manage: "s.foo ; s.bar ;" instead of "foo ;
bar ;".  I can avoid these "s." prefixes by putting everything inside
an instance_eval, but then I am back to exactly the same problem I had
in my second post in this thread.  Namely, "foo = 99" creates a local
variable 'foo' instead of calling Stuff#foo=, whereupon I have two
'foo's and all hell breaks loose.