Class: Copland::Instantiator::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/copland/instantiator/abstract.rb

Overview

The ancestor class of all instantiators. It provides functionality common to all instantiators.

Direct Known Subclasses

Complex, Identity, Simple

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#definitionObject (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

#pointObject (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

#instantiateObject

Raises a NotImplementedError. Subclasses must override this method and provide functionality for instantiating a service point.

Raises:

  • (NotImplementedError)


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