Class: Copland::Instantiator::Abstract
- Inherits:
-
Object
- Object
- Copland::Instantiator::Abstract
- Defined in:
- lib/copland/instantiator/abstract.rb
Overview
The ancestor class of all instantiators. It provides functionality common to all instantiators.
Instance Attribute Summary collapse
-
#definition ⇒ Object
readonly
The definition data for this instantiator.
-
#point ⇒ Object
readonly
The service point that this instantiator is intended to, well, instantiate.
Class Method Summary collapse
-
.register_as(name) ⇒ Object
A convenience method for registering
self
with the ClassFactory under the given name.
Instance Method Summary collapse
-
#initialize(point, definition) ⇒ Abstract
constructor
Create a new instantiator using the given service point and definition data.
-
#instantiate ⇒ Object
Raises a NotImplementedError.
-
#validate! ⇒ Object
Does nothing.
Constructor Details
#initialize(point, definition) ⇒ Abstract
Create a new instantiator using the given service point and definition data.
61 62 63 64 |
# File 'lib/copland/instantiator/abstract.rb', line 61 def initialize( point, definition ) @point = point @definition = definition end |
Instance Attribute Details
#definition ⇒ Object (readonly)
The definition data for this instantiator. Each subclass may choose to interpret this property differently.
57 58 59 |
# File 'lib/copland/instantiator/abstract.rb', line 57 def definition @definition end |
#point ⇒ Object (readonly)
The service point that this instantiator is intended to, well, instantiate.
53 54 55 |
# File 'lib/copland/instantiator/abstract.rb', line 53 def point @point end |
Class Method Details
.register_as(name) ⇒ Object
A convenience method for registering self
with the ClassFactory under the given name. This will also add a name
method to the class, which will return the value of the name
parameter.
79 80 81 82 83 84 85 86 |
# File 'lib/copland/instantiator/abstract.rb', line 79 def self.register_as( name ) class_eval <<-EOF def name #{name.inspect} end EOF Copland::ClassFactory.instance.register( POOL_NAME, name, self ) end |
Instance Method Details
#instantiate ⇒ Object
Raises a NotImplementedError. Subclasses must override this method and provide functionality for instantiating a service point.
68 69 70 |
# File 'lib/copland/instantiator/abstract.rb', line 68 def instantiate raise NotImplementedError end |
#validate! ⇒ Object
Does nothing.
73 74 |
# File 'lib/copland/instantiator/abstract.rb', line 73 def validate! end |