Class: Fbp::Decode_node
Overview
Description
The Decode node takes it incoming IP that is an JSON encoded IP and decodes it into a Ruby hash to be sent on to the downstream node.
This node would be used when receiving an IP from 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 checked for the :json key.
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 checked for the :json key. If is exists then the data will be extracted and the reconstituted data will be sent to the down stream node. If the IP does not have the :json key it will be sent to the down stream node as is.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fbp/decode-node.rb', line 21 def do_node_work(args) return super(args) if !args.has_key?(:json) decoded_obj = nil begin decoded_obj = JSON.parse(args) rescue decoded_obj = nil end super(decoded_obj) end |