Class: GnCrossmap::ResultProcessor

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

Overview

Processes data received from the GN Resolver

Constant Summary collapse

MATCH_TYPES =
{
  0 => "No match",
  1 => "Exact match",
  2 => "Canonical form exact match",
  3 => "Canonical form fuzzy match",
  4 => "Partial canonical form match",
  5 => "Partial canonical form fuzzy match",
  6 => "Genus part match"
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(writer) ⇒ ResultProcessor

Returns a new instance of ResultProcessor.



16
17
18
19
# File 'lib/gn_crossmap/result_processor.rb', line 16

def initialize(writer)
  @writer = writer
  @input = {}
end

Instance Attribute Details

#inputObject (readonly)

Returns the value of attribute input.



14
15
16
# File 'lib/gn_crossmap/result_processor.rb', line 14

def input
  @input
end

#writerObject (readonly)

Returns the value of attribute writer.



14
15
16
# File 'lib/gn_crossmap/result_processor.rb', line 14

def writer
  @writer
end

Instance Method Details

#process(result, original_data) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/gn_crossmap/result_processor.rb', line 21

def process(result, original_data)
  @original_data = original_data
  res = rubyfy(result)
  res[:data].each do |d|
    d[:results].nil? ? write_empty_result(d) : write_result(d)
  end
end