M
Matt Harrison
I'm trying to implement the singleton design in some classes. According
to ruby-doc.org[1] page on singletons, it should be fairly straightforward.
Unfortunately, I'm running into problems. Take the following declaration:
class Config
require 'yaml'
include Singleton
.....
end
When trying to use the class I get:
uninitialized constant Config::Singleton (NameError)
Also, I am not sure how to change from using the initialize method.
Normally, the Config class is initialized with a username, and then
provides methods to load/save, add/delete config directives.
Any tips on converting this class much apprecited.
Thanks
Matt
to ruby-doc.org[1] page on singletons, it should be fairly straightforward.
Unfortunately, I'm running into problems. Take the following declaration:
class Config
require 'yaml'
include Singleton
.....
end
When trying to use the class I get:
uninitialized constant Config::Singleton (NameError)
Also, I am not sure how to change from using the initialize method.
Normally, the Config class is initialized with a username, and then
provides methods to load/save, add/delete config directives.
Any tips on converting this class much apprecited.
Thanks
Matt