Class: Needle::Models::Prototype
- Inherits:
-
Object
- Object
- Needle::Models::Prototype
- Defined in:
- lib/needle/models/prototype.rb
Overview
The definition of the “prototype” lifecycle service model. This will result in immediate instantiation of the requested service, with a new instance being returned every time #instance is invoked.
Instance Method Summary collapse
-
#initialize(container, opts = {}, &callback) ⇒ Prototype
constructor
Create a new instance of the Prototype service model.
-
#instance ⇒ Object
Invoke the callback that was given when the service model was instantiated, passing the service model’s container reference.
Constructor Details
#initialize(container, opts = {}, &callback) ⇒ Prototype
Create a new instance of the Prototype service model.
26 27 28 29 |
# File 'lib/needle/models/prototype.rb', line 26 def initialize( container, opts={}, &callback ) @container = container @callback = callback end |
Instance Method Details
#instance ⇒ Object
Invoke the callback that was given when the service model was instantiated, passing the service model’s container reference.
33 34 35 |
# File 'lib/needle/models/prototype.rb', line 33 def instance @callback.call( @container ) end |