Class: GnCrossmap::Resolver

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

Overview

Sends data to GN Resolver and collects results

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(writer, data_source_id, resolver_url, stats, with_classification = false) ⇒ Resolver

Returns a new instance of Resolver.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/gn_crossmap/resolver.rb', line 8

def initialize(writer, data_source_id,
               resolver_url, stats, with_classification = false)
  @stats = stats
  @resolver_url = resolver_url
  @processor = GnCrossmap::ResultProcessor.
               new(writer, @stats, with_classification)
  @ds_id = data_source_id
  @count = 0
  @current_data = {}
  @batch = 200
end

Instance Attribute Details

#statsObject (readonly)

Returns the value of attribute stats.



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

def stats
  @stats
end

Instance Method Details

#resolve(data) {|@stats.stats| ... } ⇒ Object

Yields:



20
21
22
23
24
25
# File 'lib/gn_crossmap/resolver.rb', line 20

def resolve(data)
  update_stats(data.size)
  block_given? ? process(data, &Proc.new) : process(data)
  wrap_up
  yield(@stats.stats) if block_given?
end