From: Enrique Comba Riepenhausen Date: 2009-12-11T18:45:37+09:00 Subject: Re: solve this ruby problem Hello Govinda, your sample program does not have any error as such. The message you are getting is a warning that Object#id is going to be deprecated in future Ruby versions and you should consider using Object#object_id instead so that your program will run in latter versions. For more on Singletons you can refer to: - http://en.wikipedia.org/wiki/Singleton_pattern Basically in Ruby implementing a singleton is as simple as (inside of IRB): >> require 'singleton' => true >> class MyLogger >> include Singleton >> end => MyLogger >> MyLogger.new NoMethodError: private method `new' called for MyLogger:Class from (irb):5 >> MyLogger.instance => # >> Hope this helps. Enrique On 11 Dec 2009, at 09:22, Govinda Khanal wrote: > below are the command and the error shows by complier: > > > class MyLogger > private_class_method :new > @@logger = nil > def MyLogger.create > @@logger = new unless @@logger > @@logger > end > end > MyLogger.create.id > > > > > the error is like this > > 1.rb:9: warning: Object#id will be deprecated; use Object#object_id > > > thank you for you help > and i want to know more about Singletons > -- > Posted via http://www.ruby-forum.com/. >