Class: GnCrossmap::ResultProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/gn_crossmap/result_processor.rb

Overview

Processes data received from the GN Resolver

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#inputObject (readonly)

Returns the value of attribute input.



6
7
8
# File 'lib/gn_crossmap/result_processor.rb', line 6

def input
  @input
end

#writerObject (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