Module: Dataflow::Node
- Included in:
- Dataflow::Nodes::ComputeNode, Dataflow::Nodes::DataNode
- Defined in:
- lib/dataflow/node.rb
Overview
Define (default) common interface for nodes. These may be overriden with their specific implementations.
Class Method Summary collapse
-
.find(id) ⇒ Object
Returns either a DataNode or a ComputeNode that match the id.
Instance Method Summary collapse
- #recompute(*args) ⇒ Object
- #updated? ⇒ Boolean
-
#valid_for_computation? ⇒ Boolean
Overriden in computed node.
- #validate! ⇒ Object
Class Method Details
.find(id) ⇒ Object
Returns either a DataNode or a ComputeNode that match the id
7 8 9 10 11 12 13 14 15 |
# File 'lib/dataflow/node.rb', line 7 def self.find(id) begin return Dataflow::Nodes::DataNode.find(id) rescue Mongoid::Errors::DocumentNotFound # try again against a computed node end Dataflow::Nodes::ComputeNode.find(id) end |
Instance Method Details
#recompute(*args) ⇒ Object
21 22 23 |
# File 'lib/dataflow/node.rb', line 21 def recompute(*args) # Interface only, for recursion purposes end |
#updated? ⇒ Boolean
17 18 19 |
# File 'lib/dataflow/node.rb', line 17 def updated? true end |
#valid_for_computation? ⇒ Boolean
Overriden in computed node
26 27 28 |
# File 'lib/dataflow/node.rb', line 26 def valid_for_computation? true end |
#validate! ⇒ Object
30 31 32 33 34 35 |
# File 'lib/dataflow/node.rb', line 30 def validate! # throw if normal model validation do not pass. valid = valid_for_computation? raise Dataflow::Errors::InvalidConfigurationError, errors. unless valid true end |