Class: Scorpion::Nest

Inherits:
Object
  • Object
show all
Defined in:
lib/scorpion/nest.rb

Overview

A scorpion factory

Associations collapse

Instance Method Summary collapse

Constructor Details

#initialize(mother = nil) ⇒ Nest

Returns a new instance of Nest.



17
18
19
# File 'lib/scorpion/nest.rb', line 17

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

Instance Attribute Details

#motherScorpion

Returns the mother scorpion that that will #conceive new scorpions for each request.

Returns:

  • (Scorpion)

    the mother scorpion that that will #conceive new scorpions for each request.



12
13
14
# File 'lib/scorpion/nest.rb', line 12

def mother
  @mother
end

Instance Method Details

#conceiveScorpion

Returns a new scorpion used to hunt for dependencies.

Returns:

  • (Scorpion)

    a new scorpion used to hunt for dependencies.



26
27
28
# File 'lib/scorpion/nest.rb', line 26

def conceive
  mother.replicate
end

#destroyObject

Free up any persistent resources



31
32
33
34
# File 'lib/scorpion/nest.rb', line 31

def destroy
  mother.destroy
  @mother = nil
end

#prepare(&block) ⇒ Object



21
22
23
# File 'lib/scorpion/nest.rb', line 21

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

#resetObject

Reset the hunting map and clear all dependencies.



37
38
39
# File 'lib/scorpion/nest.rb', line 37

def reset
  mother.reset
end