Class: Distem::Node::Forge
- Inherits:
-
Object
- Object
- Distem::Node::Forge
- Defined in:
- lib/distem/node/forge.rb
Overview
Interfaced used to “blacksmith” resources: apply a specify algorithm to a physical resource in order to modify it to fit with the virtual resources specifications
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- (Object) algorithm
readonly
The algorithm used to “blacksmith” the resource.
-
- (Object) resource
readonly
The resource to “blacksmith”.
Instance Method Summary (collapse)
-
- (Object) apply
Apply the algorithm on the physical resource.
-
- (Forge) initialize(resource, algorithm)
constructor
Create a new Forge specifying the resource to modify and the algorithm to use ==== Attributes *
resource
The Resource object *algorithm
The Algorithm object. -
- (Object) undo
Undo the algorithm on the physical resource.
Constructor Details
- (Forge) initialize(resource, algorithm)
Create a new Forge specifying the resource to modify and the algorithm to use
Attributes
-
resource
The Resource object -
algorithm
The Algorithm object
18 19 20 21 22 23 |
# File 'lib/distem/node/forge.rb', line 18 def initialize(resource,algorithm) @resource = resource raise Lib::InvalidParameterError, algorithm if \ algorithm and !algorithm.is_a?(Algorithm::Algorithm) @algorithm = algorithm end |
Instance Attribute Details
- (Object) algorithm (readonly)
The algorithm used to “blacksmith” the resource
11 12 13 |
# File 'lib/distem/node/forge.rb', line 11 def algorithm @algorithm end |
- (Object) resource (readonly)
The resource to “blacksmith”
9 10 11 |
# File 'lib/distem/node/forge.rb', line 9 def resource @resource end |
Instance Method Details
- (Object) apply
Apply the algorithm on the physical resource
26 27 28 |
# File 'lib/distem/node/forge.rb', line 26 def apply() @algorithm.apply(@resource) end |
- (Object) undo
Undo the algorithm on the physical resource
31 32 33 |
# File 'lib/distem/node/forge.rb', line 31 def undo() @algorithm.undo(@resource) end |