Class: Tap::Support::Join
- Includes:
- Configurable
- Defined in:
- lib/tap/support/join.rb
Overview
Joins create on_complete blocks which link together tasks (or more generally, Executable objects) into workflows. Joins support a variety of configurations which affect how one task passes inputs to subsequent tasks.
Joins have a single source and may have multiple targets. See ReverseJoin for joins with a single target and multiple sources.
Direct Known Subclasses
Tap::Support::Joins::Fork, Tap::Support::Joins::Sequence, Tap::Support::Joins::Switch, ReverseJoin
Constant Summary collapse
- FLAGS =
An array of workflow flags. Workflow flags are false unless specified.
configurations.keys
- SHORT_FLAGS =
An array of the first character in each WORKFLOW_FLAGS.
FLAGS.collect {|flag| flag.to_s[0,1]}
Instance Attribute Summary
Attributes included from Configurable
Class Method Summary collapse
-
.join(source, targets, &block) ⇒ Object
Create a join between the source and targets.
Instance Method Summary collapse
-
#initialize(config) ⇒ Join
constructor
Initializes a new join with the specified configuration.
-
#inspect ⇒ Object
Returns a string like: “#<Join:object_id>”.
-
#join(source, targets, &block) ⇒ Object
Creates a join between the source and targets.
-
#name ⇒ Object
The name of the join, as a symbol.
-
#options ⇒ Object
A hash of the configurations set to true.
Methods included from Configurable
included, #initialize_copy, #reconfigure
Constructor Details
#initialize(config) ⇒ Join
Initializes a new join with the specified configuration.
45 46 47 |
# File 'lib/tap/support/join.rb', line 45 def initialize(config) initialize_config(config) end |
Class Method Details
.join(source, targets, &block) ⇒ Object
Create a join between the source and targets. Targets should be an array; if the last member of targets is a hash, it will be used as the configurations for the join.
17 18 19 20 |
# File 'lib/tap/support/join.rb', line 17 def join(source, targets, &block) = targets[-1].kind_of?(Hash) ? targets.pop : {} new().join(source, targets, &block) end |
Instance Method Details
#inspect ⇒ Object
Returns a string like: “#<Join:object_id>”
69 70 71 |
# File 'lib/tap/support/join.rb', line 69 def inspect "#<Join:#{object_id}>" end |
#join(source, targets, &block) ⇒ Object
Creates a join between the source and targets. Must be implemented in subclasses.
57 58 59 |
# File 'lib/tap/support/join.rb', line 57 def join(source, targets, &block) raise NotImplementedError end |
#name ⇒ Object
The name of the join, as a symbol. By default name is the basename of the underscored class.
51 52 53 |
# File 'lib/tap/support/join.rb', line 51 def name File.basename(self.class.to_s.underscore).to_sym end |
#options ⇒ Object
A hash of the configurations set to true.
62 63 64 65 66 |
# File 'lib/tap/support/join.rb', line 62 def opts = config.to_hash opts.delete_if {|key, value| value == false } opts end |