Class: Seasar::Container::Deployer::SingletonComponentDeployer
- Inherits:
-
AbstractComponentDeployer
- Object
- AbstractComponentDeployer
- Seasar::Container::Deployer::SingletonComponentDeployer
- Defined in:
- lib/seasar/container/deployer/singleton-component-deployer.rb
Overview
コンポーネントのインスタンス管理をSingletonとするDeployerクラスです。
Instance Method Summary collapse
-
#deploy ⇒ Object
コンポーネントを構築します。 - args - none - return - Object.
-
#destroy ⇒ Object
-
args - none - return - none.
-
-
#init ⇒ Object
-
args - none - return - Object.
-
-
#initialize(component_def) ⇒ SingletonComponentDeployer
constructor
SingletonComponentDeployerを構築します。 - args 1.
Methods inherited from AbstractComponentDeployer
Constructor Details
#initialize(component_def) ⇒ SingletonComponentDeployer
SingletonComponentDeployerを構築します。
-
args
-
Seasar::Container::ComponentDef component_def
-
28 29 30 31 32 |
# File 'lib/seasar/container/deployer/singleton-component-deployer.rb', line 28 def initialize(component_def) super @component = nil @instantiating = false end |
Instance Method Details
#deploy ⇒ Object
コンポーネントを構築します。
-
args
-
none
-
-
return
-
Object
-
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/seasar/container/deployer/singleton-component-deployer.rb', line 39 def deploy if @component.nil? if @instantiating raise Seasar::Container::Exception::CyclicReferenceRuntimeException.new(@component_def.component_class) end @instantiating = true @component = @constructor_assembler.assemble @instantiating = false @property_assembler.assemble(@component) end return @component end |
#destroy ⇒ Object
-
args
-
none
-
-
return
-
none
-
65 66 67 68 69 70 71 |
# File 'lib/seasar/container/deployer/singleton-component-deployer.rb', line 65 def destroy return if @component.nil? if @component_def.destructor @component_def.destructor.call(@component) end @component = nil end |
#init ⇒ Object
-
args
-
none
-
-
return
-
Object
-
56 57 58 59 |
# File 'lib/seasar/container/deployer/singleton-component-deployer.rb', line 56 def init @component = nil self.deploy end |