Class: Wukong::Processor::Echo

Inherits:
Wukong::Processor show all
Defined in:
lib/wukong/widget/echo.rb

Overview

A widget that yields whatever you instantiate it with.

This is most useful when you have a small but predictable input that you don't want or can't pass via usual input channels like STDIN.

This differs from from the :identity processor because it doesn't pass on what it receives but what you instantiate it with.

Examples:

Works just like you think on the command line


$ echo something else | wu-local echo --input=hello
hello

Pass some fixed input to your downstream code.


# my_flow.rb
Wukong.dataflow(:my_flow) do
  echo(input: {key: 'value'}) | my_proc | ...
end

See Also:

Constant Summary

Constants inherited from Wukong::Processor

SerializerError

Instance Attribute Summary

Attributes included from Hanuman::StageInstanceMethods

#graph

Instance Method Summary collapse

Methods inherited from Wukong::Processor

configure, description, #finalize, #perform_action, #receive_action, #setup, #stop

Methods included from Logging

included

Methods inherited from Hanuman::Stage

#clone

Methods included from Hanuman::StageClassMethods

#builder, #label, #register, #set_builder

Methods included from Hanuman::StageInstanceMethods

#add_link, #linkable_name, #root

Instance Method Details

#process(_) {|input| ... } ⇒ Object

Yields the input no matter what you pass it.

Parameters:

  • _ (Object)

    the new input record which is ignored

Yields:

  • (input)

Yield Parameters:

  • input (Object)

    the original input



49
50
51
# File 'lib/wukong/widget/echo.rb', line 49

def process _
  yield input
end