Class: Scorpion::Nest
- Inherits:
-
Object
- Object
- Scorpion::Nest
- Defined in:
- lib/scorpion/nest.rb
Overview
A scorpion factory
Associations collapse
-
#mother ⇒ Scorpion
The mother scorpion that that will #conceive new scorpions for each request.
Instance Method Summary collapse
-
#conceive ⇒ Scorpion
A new scorpion used to hunt for dependencies.
-
#destroy ⇒ Object
Free up any persistent resources.
-
#initialize(mother = nil) ⇒ Nest
constructor
A new instance of Nest.
- #prepare(&block) ⇒ Object
-
#reset ⇒ Object
Reset the hunting map and clear all dependencies.
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
Instance Method Details
#conceive ⇒ Scorpion
Returns a new scorpion used to hunt for dependencies.
26 27 28 |
# File 'lib/scorpion/nest.rb', line 26 def conceive mother.replicate end |
#destroy ⇒ Object
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 |
#reset ⇒ Object
Reset the hunting map and clear all dependencies.
37 38 39 |
# File 'lib/scorpion/nest.rb', line 37 def reset mother.reset end |