Module: Multiton::MetaMethods

Module | Multiton::MetaMethods
In: | lib/more/facets/multiton.rb

### Methods

_load initialized? instance multiton_instance multiton_mutex new reinitialize

### Included Modules

Inclusive

### Public Instance methods

initialized?(*e, &b)

[Source]

    # File lib/more/facets/multiton.rb, line 230
        def initialized?(*e, &b)
          multiton_instance.key?(multiton_id(*e, &b))
        end

instance(*e, &b)

[Source]

    # File lib/more/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)

[Source]

    # File lib/more/facets/multiton.rb, line 249
        def _load(str)
          instance(*Marshal.load(str))
        end

multiton_instance()

[Source]

    # File lib/more/facets/multiton.rb, line 236
        def multiton_instance
          @multiton_instance ||= Hash.new
        end

multiton_mutex()

[Source]

    # File lib/more/facets/multiton.rb, line 240
        def multiton_mutex
          @multiton_mutex ||= InstanceMutex.new
        end

reinitialize()

[Source]

    # File lib/more/facets/multiton.rb, line 244
        def reinitialize
          multiton_instance.clear
          multiton_mutex.clear
        end

[Validate]