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, opts) ⇒ Resolver

Returns a new instance of Resolver.



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

def initialize(writer, opts)
  instance_vars_from_opts(opts)
  @processor = GnCrossmap::ResultProcessor.
               new(writer, @stats, @with_classification)
  @count = 0
  @jobs = []
  @batch = 200
  @smoothing = 0.05
end

Instance Attribute Details

#statsObject (readonly)

Returns the value of attribute stats.



8
9
10
# File 'lib/gn_crossmap/resolver.rb', line 8

def stats
  @stats
end

Instance Method Details

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

Yields:



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

def resolve(data)
  resolution_stats(data.size)
  @threads.times do
    batch = data.shift(@batch)
    add_job(batch)
  end
  block_given? ? traverse_jobs(data, &Proc.new) : traverse_jobs(data)
  wrap_up
  yield(@stats.stats) if block_given?
end