James Gray
8/8/2006 8:36:00 PM
On Aug 8, 2006, at 2:50 PM, coachhilton@gmail.com wrote:
> Sure, these are really
> global variables packaged up in the base class but at least they are
> encapsulate and the script doesn't know where they came from or how
> they got there.
You can also make the class a singleton so all code works with just
one configuration object:
>> require "singleton"
=> true
>> class Config
>> include Singleton
>> end
=> Config
>> p Config.instance.object_id
1651794
=> nil
>> # and later, in an unrelated piece of code...
?> p Config.instance.object_id
1651794
=> nil
James Edward Gray II