Class: Tap::Support::Node
Overview
Represents a task node in a Schema.
Instance Attribute Summary collapse
-
#argv ⇒ Object
An array of arguments used to instantiate the node.
-
#input ⇒ Object
The input or source for the node.
-
#output ⇒ Object
The output for the node.
Instance Method Summary collapse
-
#global? ⇒ Boolean
True if the input and output are nil.
-
#globalize ⇒ Object
Resets the source and join to nil.
-
#initialize(argv = [], input = nil, output = nil) ⇒ Node
constructor
A new instance of Node.
- #inspect ⇒ Object
-
#round ⇒ Object
Returns the round for self; a round is indicated by an integer input.
-
#round=(input) ⇒ Object
Alias for input=.
Constructor Details
#initialize(argv = [], input = nil, output = nil) ⇒ Node
Returns a new instance of Node.
21 22 23 24 25 |
# File 'lib/tap/support/node.rb', line 21 def initialize(argv=[], input=nil, output=nil) @argv = argv @input = input @output = output end |
Instance Attribute Details
#argv ⇒ Object
An array of arguments used to instantiate the node
9 10 11 |
# File 'lib/tap/support/node.rb', line 9 def argv @argv end |
#input ⇒ Object
The input or source for the node. Inputs may be a Join, nil, or an Integer. An Integer input indicates that the node should be enqued to a round using argv as inputs.
15 16 17 |
# File 'lib/tap/support/node.rb', line 15 def input @input end |
#output ⇒ Object
The output for the node. Output may be a a Join or nil.
19 20 21 |
# File 'lib/tap/support/node.rb', line 19 def output @output end |
Instance Method Details
#global? ⇒ Boolean
True if the input and output are nil.
34 35 36 |
# File 'lib/tap/support/node.rb', line 34 def global? input == nil && output == nil end |
#globalize ⇒ Object
Resets the source and join to nil.
28 29 30 31 |
# File 'lib/tap/support/node.rb', line 28 def globalize self.input = nil self.output = nil end |
#inspect ⇒ Object
50 51 52 |
# File 'lib/tap/support/node.rb', line 50 def inspect "#<#{self.class}:#{object_id} argv=[#{argv.join(' ')}] input=#{input.inspect} output=#{output.inspect}>" end |
#round ⇒ Object
Returns the round for self; a round is indicated by an integer input. If input is anything but an integer, round returns nil.
41 42 43 |
# File 'lib/tap/support/node.rb', line 41 def round input.kind_of?(Integer) ? input : nil end |
#round=(input) ⇒ Object
Alias for input=
46 47 48 |
# File 'lib/tap/support/node.rb', line 46 def round=(input) self.input = input end |