Class: Wukong::Processor::Flatten
- Inherits:
-
Wukong::Processor
- Object
- Hanuman::Stage
- Wukong::Processor
- Wukong::Processor::Flatten
- Defined in:
- lib/wukong/widget/operators.rb
Overview
If an input record defines the #each method then yield each of its records. Otherwise yield the input record.
Constant Summary
Constants inherited from Wukong::Processor
Instance Attribute Summary
Attributes included from Hanuman::StageInstanceMethods
Instance Method Summary collapse
-
#process(input_record) {|output_record| ... } ⇒ Object
If input_record responds to #each then yield each of these as an output record.
Methods inherited from Wukong::Processor
configure, description, #finalize, #perform_action, #receive_action, #setup, #stop
Methods included from Logging
Methods inherited from Hanuman::Stage
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_record) {|output_record| ... } ⇒ Object
If input_record responds to #each then yield each of these as an output record. Else, just yield the input_record.
71 72 73 74 75 76 77 |
# File 'lib/wukong/widget/operators.rb', line 71 def process(input_record) if input_record.respond_to?(:each) input_record.each{ |output_record| yield(output_record) } else yield(input_record) end end |