Sha256: 6510fe1dba8897d956b76aa2ba314ef7b7f0d2eb488c8a2ccbeaea2d98364817

Contents?: true

Size: 850 Bytes

Versions: 35

Compression:

Stored size: 850 Bytes

Contents

module Scorpion
  # A scorpion factory
  class Nest

    # ============================================================================
    # @!group Associations
    #

    # @!attribute
    # @return [Scorpion] the mother scorpion that that will {#conceive} new
    #   scorpions for each request.
      attr_reader :mother

    #
    # @!endgroup Associations

    def initialize( mother = nil )
      @mother = mother || Scorpion::Hunter.new
    end

    def prepare( &block )
      mother.prepare &block
    end

    # @return [Scorpion] a new scorpion used to hunt for dependencies.
    def conceive
      mother.replicate
    end

    # Free up any persistent resources
    def destroy
      mother.destroy
      @mother = nil
    end

    # Reset the hunting map and clear all dependencies.
    def reset
      mother.reset
    end

  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
scorpion-ioc-1.0.10 lib/scorpion/nest.rb
scorpion-ioc-1.0.8 lib/scorpion/nest.rb
scorpion-ioc-1.0.7 lib/scorpion/nest.rb
scorpion-ioc-1.0.6 lib/scorpion/nest.rb
scorpion-ioc-1.0.4 lib/scorpion/nest.rb
scorpion-ioc-1.0.3 lib/scorpion/nest.rb
scorpion-ioc-1.0.2 lib/scorpion/nest.rb
scorpion-ioc-1.0.1 lib/scorpion/nest.rb
scorpion-ioc-1.0.0 lib/scorpion/nest.rb
scorpion-ioc-0.6.2 lib/scorpion/nest.rb
scorpion-ioc-0.6.1 lib/scorpion/nest.rb
scorpion-ioc-0.6.0 lib/scorpion/nest.rb
scorpion-ioc-0.5.23 lib/scorpion/nest.rb
scorpion-ioc-0.5.22 lib/scorpion/nest.rb
scorpion-ioc-0.5.21 lib/scorpion/nest.rb
scorpion-ioc-0.5.20 lib/scorpion/nest.rb
scorpion-ioc-0.5.19 lib/scorpion/nest.rb
scorpion-ioc-0.5.18 lib/scorpion/nest.rb
scorpion-ioc-0.5.17 lib/scorpion/nest.rb
scorpion-ioc-0.5.16 lib/scorpion/nest.rb