Method: Wukong::DriverMethods#construct_dataflow

Defined in:
lib/wukong/driver.rb

#construct_dataflow(label, settings = {}) ⇒ Object

Construct a dataflow from the given label and settings.

This method does not cause Processor#setup to be called on any of the processors in the dataflow. Call the #setup_dataflow method to explicitly have setup occur. This distinction is useful for drivers which themselves need to do complex initialization before letting processors in the dataflow initialize.

Parameters:

  • label (Symbol)

    the name of the dataflow (or processor) to build

  • settings (Hash) (defaults to: {})
  • settings (String) (defaults to: {})

    :to Serialize all output via the named serializer (json, tsv)

  • settings (String) (defaults to: {})

    :from Deserialize all input via the named deserializer (json, tsv)

  • settings (String) (defaults to: {})

    :as Recordize each input as instances of the given class

See Also:



84
85
86
87
88
89
90
91
# File 'lib/wukong/driver.rb', line 84

def construct_dataflow(label, settings={})
  self.label    = label
  self.settings = settings
  prepend(:recordize)                       if settings[:as]
  prepend("from_#{settings[:from]}".to_sym) if settings[:from]
  append("to_#{settings[:to]}".to_sym)      if settings[:to]
  build_dataflow
end