Sha256: 30134c5c8221ae98715a998a64b9f7340766770fc7d709aa870db2db036b682d

Contents?: true

Size: 1.68 KB

Versions: 1

Compression:

Stored size: 1.68 KB

Contents

#--
# =============================================================================
# Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
# All rights reserved.
#
# This source file is distributed as part of the Needle dependency injection
# library for Ruby. This file (and the library as a whole) may be used only as
# allowed by either the BSD license, or the Ruby license (or, by association
# with the Ruby license, the GPL). See the "doc" subdirectory of the Needle
# distribution for the texts of these licenses.
# -----------------------------------------------------------------------------
# needle website : http://needle.rubyforge.org
# project website: http://rubyforge.org/projects/needle
# =============================================================================
#++

require 'needle/models/prototype'
require 'needle/models/prototype-deferred'
require 'needle/models/singleton'
require 'needle/models/singleton-deferred'

module Needle
  module Models

    # A convenience method for registering all standard service models with
    # a container. This also defines a <tt>:service_models</tt> service,
    # implemented as a Hash, which is used for keeping the references to
    # installed service models.
    #
    # This method is called internally by Registry when it is instantiated,
    # and should never be called directly.
    def register( registry )
      registry.register( :service_models, :model => Singleton ) { Hash.new }
      registry[:service_models].update(
        :singleton => Singleton,
        :singleton_deferred => SingletonDeferred,
        :prototype => Prototype,
        :prototype_deferred => PrototypeDeferred
      )
    end
    module_function :register

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
needle-0.5.0 lib/needle/models.rb