mutahhir hayat wrote:
> Hi,
> 
> If you're using the Singleton Module from the standard library, i
> think it must have a flag or something that automatically gets marked
> when it first creates the instance object. By setting that instance to
> nil, you allow the garbage collector to clean it, however, the flag
> being a class member, exists in memory still and remembers that it has
> already created the instance. So, allows you to access it, which in
> effect passes you a nil, hence the error.
> 
> Solution... hmm.... probably you'd like to use a self-brewed singleton
> class. Or by adding a resource-cleanup method, that releases all your
> images, that can be called by the last mob's destructor. I'd go with
> the second, so that your singleton class becomes lean, yet still
> exists, when you don't need it.
> 
> Mt.

Thanks :)

i did this

  private_class_method :new
  attr_accessor :animacao, :animacao_delay, :deslocamento_x, 
:deslocamento_y

  def Info.create(*args, &block)
    @me = new(*args, &block) if ! @me

    if @descarregar == true
      @me.initialize(*args, &block)
    else
      return @me
    end
  end
  def initialize()
      @descarregar = false
  end
  def destruir
      everything = nil
      @descarregar = true
  end


its working :)


Thanks mutahhir
-- 
Posted via http://www.ruby-forum.com/.