Class: Copland::ServiceModel::SingletonDeferredServiceModel
- Inherits:
-
SingletonServiceModel
- Object
- AbstractServiceModel
- SingletonServiceModel
- Copland::ServiceModel::SingletonDeferredServiceModel
- Defined in:
- lib/copland/models/singleton-deferred.rb
Overview
This is the deferred variety of the Singleton service model. Instead of immediately instantiating the service point when requested to, it instead wraps the service point in a Proxy object, which will cause the service point to be instantiated as soon as a method is invoked on the Proxy. Then, the proxy will forward all subsequent calls to the service itself.
Instance Attribute Summary
Attributes inherited from AbstractServiceModel
Instance Method Summary collapse
-
#new_instance(&init) ⇒ Object
Creates an instance of Proxy that encapsulates the service point.
Methods inherited from SingletonServiceModel
Methods inherited from AbstractServiceModel
#initialize, #instance, register_as
Constructor Details
This class inherits a constructor from Copland::ServiceModel::SingletonServiceModel
Instance Method Details
#new_instance(&init) ⇒ Object
Creates an instance of Proxy that encapsulates the service point.
49 50 51 |
# File 'lib/copland/models/singleton-deferred.rb', line 49 def new_instance( &init ) @instance = Proxy.new( @service_point, &init ) end |