Class: Wukong::DataflowBuilder

Inherits:
Hanuman::GraphBuilder show all
Defined in:
lib/wukong/dataflow.rb

Instance Method Summary collapse

Methods inherited from Hanuman::GraphBuilder

#build, #clone, #define, #directed_sort, #extract_links!, #serialize, #stage_specific_options, #tsort_each_child, #tsort_each_node

Methods inherited from Hanuman::StageBuilder

#add_link, #build, #clone, #define, #define_class, #handle_extra_attributes, #into, #merge!, #serialize

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &blk) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/wukong/dataflow.rb', line 24

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



4
5
6
7
# File 'lib/wukong/dataflow.rb', line 4

def description desc=nil
  @description = desc if desc
  @description
end

#handle_dsl_arguments_for(stage, *args, &action) ⇒ Object



11
12
13
14
15
# File 'lib/wukong/dataflow.rb', line 11

def handle_dsl_arguments_for(stage, *args, &action)
  options = args.extract_options!
  stage.merge!(options.merge(action: action).compact)
  stage      
end

#linkable_name(direction) ⇒ Object



17
18
19
20
21
22
# File 'lib/wukong/dataflow.rb', line 17

def linkable_name(direction) 
  case direction
  when :in  then directed_sort.first
  when :out then directed_sort.last
  end
end

#namespaceObject



9
# File 'lib/wukong/dataflow.rb', line 9

def namespace() Wukong::Dataflow ; end