On Dec 19, 2005, at 2:12 AM, List R. wrote:
Posted via http://www.ruby-forum.com/.
Thread.current[“my singleton”] ||= MyOnePerThreadClass.new #
note, don’t actually make MyOnePerThreadClass a “real” singleton
Then whenever you want to use the thread singleton in a given thread
use the thread_singleton function
thread_singleton.send_other_message # a different singleton
for this thread than the other thread, but will be the same for the
duration of this thread
As far as your Name.method question, there’s no particular reason not
to… If you want you can implement a singleton like that.