Class: Fbp::Encode_node
Overview
Description
The Encode node takes it incoming IP and encodes the IP into a JSON string. This data is then added to the incoming IP and sent to the downstream node.
This node would be used when sending IPs to another machine or another process on the same machine.
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
-
#do_node_work(args) ⇒ Object
When an IP comes in it will be converted into a JSON text object.
Methods inherited from Node
#clean_option, #execute, #initialize, #is_ready_to_run?, #merge_options!, #register_for_output_from_node, #set_option, #stop, #unregister_for_output_from_node, #wait_until_completed, #write_to_input, #write_to_output
Constructor Details
This class inherits a constructor from Fbp::Node
Instance Method Details
#do_node_work(args) ⇒ Object
When an IP comes in it will be converted into a JSON text object. That text object will then be append to the incoming IP with the :json key and sent to the down stream node.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fbp/encode-node.rb', line 19 def do_node_work(args) encoded_obj = nil begin encoded_obj = args.to_json rescue encoded_obj = nil end args.merge!({:json => encoded_obj}) if !encoded_obj.nil? super(args) end |