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 shorts in each WORKFLOW_FLAGS.
configurations.values.collect {|config| config.attributes[:short] }
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.
Constructor Details
#initialize(config) ⇒ Join
Initializes a new join with the specified configuration.
49 50 51 |
# File 'lib/tap/support/join.rb', line 49 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>”
73 74 75 |
# File 'lib/tap/support/join.rb', line 73 def inspect "#<Join:#{object_id}>" end |
#join(source, targets, &block) ⇒ Object
Creates a join between the source and targets. Must be implemented in subclasses.
61 62 63 |
# File 'lib/tap/support/join.rb', line 61 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 name.
55 56 57 |
# File 'lib/tap/support/join.rb', line 55 def name File.basename(self.class.to_s.underscore).to_sym end |
#options ⇒ Object
A hash of the configurations set to true.
66 67 68 69 70 |
# File 'lib/tap/support/join.rb', line 66 def opts = config.to_hash opts.delete_if {|key, value| value == false } opts end |