Class: Wukong::DataflowBuilder
- Inherits:
-
Hanuman::TreeBuilder
- Object
- Hanuman::StageBuilder
- Hanuman::GraphBuilder
- Hanuman::TreeBuilder
- Wukong::DataflowBuilder
- Defined in:
- lib/wukong/dataflow.rb
Constant Summary
Constants included from Hanuman::TreeInstanceMethods
Hanuman::TreeInstanceMethods::MultipleRoots
Instance Attribute Summary
Attributes included from Hanuman::StageInstanceMethods
Instance Method Summary collapse
- #description(desc = nil) ⇒ Object
- #handle_dsl_arguments_for(stage, *args, &action) ⇒ Object
- #method_missing(name, *args, &blk) ⇒ Object
- #namespace ⇒ Object
Methods included from Hanuman::TreeInstanceMethods
#add_link, #ancestor, #append, #directed_sort, #each_stage, #leaves, #prepend, #root, #tsort_each_child, #tsort_each_node
Methods inherited from Hanuman::GraphBuilder
#build, #clone, #define, #extract_links!, #serialize, #stage_specific_options
Methods included from Hanuman::GraphInstanceMethods
#add_link, #add_stage, #ancestors, #descendents, #each_stage, #has_link?
Methods inherited from Hanuman::StageBuilder
#build, #clone, #define, #define_class, #handle_extra_attributes, #into, #merge!, #serialize
Methods included from Hanuman::StageInstanceMethods
#add_link, #linkable_name, #root
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &blk) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/wukong/dataflow.rb', line 34 def method_missing(name, *args, &blk) if stages[name] handle_dsl_arguments_for(stages[name], *args, &blk) else super end end |
Instance Method Details
#description(desc = nil) ⇒ Object
11 12 13 14 |
# File 'lib/wukong/dataflow.rb', line 11 def description desc=nil @description = desc if desc @description end |
#handle_dsl_arguments_for(stage, *args, &action) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/wukong/dataflow.rb', line 18 def handle_dsl_arguments_for(stage, *args, &action) = args. while stages.include?(stage.label) parts = stage.label.to_s.split('_') if parts.last.to_i > 0 parts[-1] = parts.last.to_i + 1 else parts.push(1) end stage.label = parts.map(&:to_s).join('_').to_sym end stage.merge!(.merge(action: action).compact) stage.graph = self stage end |