Class: GnCrossmap::Resolver
- Inherits:
-
Object
- Object
- GnCrossmap::Resolver
- Defined in:
- lib/gn_crossmap/resolver.rb
Overview
Sends data to GN Resolver and collects results
Instance Attribute Summary collapse
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
Instance Method Summary collapse
-
#initialize(writer, data_source_id, resolver_url, stats, with_classification = false) ⇒ Resolver
constructor
A new instance of Resolver.
- #resolve(data) {|@stats.stats| ... } ⇒ Object
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
#stats ⇒ Object (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
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 |