Methods
Included Modules
Public Instance methods
initialized?(*e, &b)
# File lib/facets/multiton.rb, line 230
    def initialized?(*e, &b)
      multiton_instance.key?(multiton_id(*e, &b))
    end
instance(*e, &b)
This method is also aliased as new
# File lib/facets/multiton.rb, line 215
    def instance(*e, &b)
      arg = multiton_id(*e, &b)
      multiton_instance.fetch(arg) do
        multiton_mutex[arg].synchronize do
          multiton_instance.fetch(arg) do
            val = multiton_instance[arg] = new!(*e, &b) #new(*e, &b)
            val.instance_variable_set(:@multiton_initializer, e, &b)
            multiton_mutex.initialized(arg)
            val
          end
        end
      end
    end
new(*e, &b)

Alias for instance

Protected Instance methods
_load(str)
# File lib/facets/multiton.rb, line 249
    def _load(str)
      instance(*Marshal.load(str))
    end
multiton_instance()
# File lib/facets/multiton.rb, line 236
    def multiton_instance
      @multiton_instance ||= Hash.new
    end
multiton_mutex()
# File lib/facets/multiton.rb, line 240
    def multiton_mutex
      @multiton_mutex ||= InstanceMutex.new
    end
reinitialize()
# File lib/facets/multiton.rb, line 244
    def reinitialize
      multiton_instance.clear
      multiton_mutex.clear
    end
Private Instance methods
multiton_id(*e, &b)

Default method to to create a key to cache already constructed instances. In the use case MultitonClass.new(e), MultiClass.new(f) must be semantically equal if multiton_id(e).eql?(multiton_id(f)) evaluates to true.

# File lib/facets/multiton.rb, line 259
    def multiton_id(*e, &b)
      e
    end
singleton_method_added(sym)
# File lib/facets/multiton.rb, line 263
    def singleton_method_added(sym)
      super
      if (sym == :marshal_dump) & singleton_methods.include?('marshal_dump')
        raise TypeError, "Don't use marshal_dump - rely on _dump and _load instead"
      end
    end