linsc 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c96a4b8e89605a426ca261d1e3ed06c885f85f68
4
- data.tar.gz: 2ad5ec02dbc1d0f61a14a2949c35914eb36448d6
3
+ metadata.gz: d4aa43a931906d4f60928698c977045bbbcd1355
4
+ data.tar.gz: 5c255faefac63e0d197dc8f280126d0f2e45c2cd
5
5
  SHA512:
6
- metadata.gz: 2e4d496facd6efa033c1c01a02a1f70e0f5e484131e9bbc8473ce77717eb072a18a3dd99594480781d8a4e4a11d5376e5713faf5bd193037fc1ba6d0a618e041
7
- data.tar.gz: 6b981bb4168a753401d5eca4be3921e1929674bef5babf2505fdda1dc47dc67b6aa14c12e1fd5e76700bc2a022e6157f96228d3aae0e7020e63527ef6cc5e7c4
6
+ metadata.gz: 6492bbab95295b7f468526ea957f01c9b2ecd5ac3b6f0b90826085a962117dfea7d2188504c897bb964fbc1d6b1038e9c1ce3dd38140c7449a5acf0a03af58af
7
+ data.tar.gz: 5998e5de0b998d1bb5f081b55e91389b08b0b5753929ec446349ade2edce601898a449a329ae00d0b99671a5c55c4a0fdefbade06e83fe102ca0979177046e23
@@ -42,26 +42,26 @@ class CrossRef
42
42
  b = y[@master_lookup_field]
43
43
  a && b ? a <=> b : a ? -1 : 1
44
44
  end
45
- master_lookup_values = master_data.collect {|row| row[@master_lookup_field] && row[@master_lookup_field].downcase}
46
45
  i = 0
47
46
  CSV.foreach(@child_path, headers: true, encoding: 'utf-8') do |child_row|
48
47
  i += 1
49
48
  puts "email lookup - row: #{i}/#{@child_length}"
50
49
  child_lookup_value = child_row[@child_lookup_field].downcase if child_row[@child_lookup_field]
51
50
  if (child_lookup_value && child_lookup_value.include?('@')) || !@email_key ## generalize this
52
- match_index = master_lookup_values.bsearch_index do |master_lookup_value|
51
+ matching_row = master_data.bsearch do |master_lookup_row|
52
+ master_lookup_value = master_lookup_row[@master_lookup_field]
53
53
  child_lookup_value && master_lookup_value ?
54
54
  child_lookup_value <=> master_lookup_value : child_lookup_value ? -1 : 1
55
55
  end
56
- if !match_index
57
- match_index = master_data.find_index do |master_row|
56
+ if !matching_row
57
+ matching_row = master_data.find do |master_row|
58
58
  master_secondary_lookups = @master_secondary_lookups.collect{|x| x && x.downcase}
59
59
  master_secondary_lookups.include?(child_lookup_value)
60
60
  end
61
61
  end
62
- if match_index
62
+ if matching_row
63
63
  if @options[:update]
64
- append_to_csv(@output_path, splice_rows(master_data[match_index], child_row))
64
+ append_to_csv(@output_path, splice_rows(matching_row, child_row))
65
65
  end
66
66
  else
67
67
  if @options[:insert]
data/lib/linsc/duck.rb CHANGED
@@ -28,7 +28,7 @@ class DuckScraper
28
28
  @input_length = CSV.read(@input_file).length - 1
29
29
  if File.exist?(@output_file)
30
30
  @start = CSV.read(@output_file, headers: true).length
31
- puts "resuming from row #{@start}"
31
+ puts "resuming from row #{@start + 1}"
32
32
  else
33
33
  create_file(@output_file)
34
34
  end
data/linsc.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "linsc"
7
- spec.version = "0.0.7"
7
+ spec.version = "0.0.8"
8
8
  spec.authors = ["Dan Molloy"]
9
9
  spec.email = ["danieljmolloy1@gmail.com"]
10
10
  spec.date = '2016-03-31'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linsc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Molloy