Class: GnCrossmap::ResultProcessor
- Inherits:
-
Object
- Object
- GnCrossmap::ResultProcessor
- Defined in:
- lib/gn_crossmap/result_processor.rb
Overview
Processes data received from the GN Resolver
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#writer ⇒ Object
readonly
Returns the value of attribute writer.
Instance Method Summary collapse
-
#initialize(writer, stats, with_classification = false) ⇒ ResultProcessor
constructor
A new instance of ResultProcessor.
- #process(results, original_data) ⇒ Object
Constructor Details
#initialize(writer, stats, with_classification = false) ⇒ ResultProcessor
Returns a new instance of ResultProcessor.
8 9 10 11 12 13 14 |
# File 'lib/gn_crossmap/result_processor.rb', line 8 def initialize(writer, stats, with_classification = false) @with_classification = with_classification @parser = ScientificNameParser.new @stats = stats @writer = writer @input = {} end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
6 7 8 |
# File 'lib/gn_crossmap/result_processor.rb', line 6 def input @input end |
#writer ⇒ Object (readonly)
Returns the value of attribute writer.
6 7 8 |
# File 'lib/gn_crossmap/result_processor.rb', line 6 def writer @writer end |
Instance Method Details
#process(results, original_data) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/gn_crossmap/result_processor.rb', line 16 def process(results, original_data) @original_data = original_data results.each do |result| res = rubyfy(result) res[:data].each do |d| d[:results].nil? ? write_empty_result(d) : write_result(d) end end end |