From: Ben Giddings Date: 2005-04-09T07:42:24+09:00 Subject: Re: Access variables in singleton? On Friday 08 April 2005 18:30, Steve V wrote: > I created the following small singleton class, but it seems that my > variables are ignored. > > require 'singleton' > > class Context > include Singleton > > @companyname = "acme" Wrong context, this is defined within the "Context" class definition, not within the one object (instance of Context) that you create. What you want is: def initialize @companyname = "acme" end Singleton will make "new" private, but you still want to use "initialize" which will be called by "instance" Ben