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 +4 -4
- data/lib/linsc/cross_ref.rb +6 -6
- data/lib/linsc/duck.rb +1 -1
- data/linsc.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4aa43a931906d4f60928698c977045bbbcd1355
|
4
|
+
data.tar.gz: 5c255faefac63e0d197dc8f280126d0f2e45c2cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6492bbab95295b7f468526ea957f01c9b2ecd5ac3b6f0b90826085a962117dfea7d2188504c897bb964fbc1d6b1038e9c1ce3dd38140c7449a5acf0a03af58af
|
7
|
+
data.tar.gz: 5998e5de0b998d1bb5f081b55e91389b08b0b5753929ec446349ade2edce601898a449a329ae00d0b99671a5c55c4a0fdefbade06e83fe102ca0979177046e23
|
data/lib/linsc/cross_ref.rb
CHANGED
@@ -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
|
-
|
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 !
|
57
|
-
|
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
|
62
|
+
if matching_row
|
63
63
|
if @options[:update]
|
64
|
-
append_to_csv(@output_path, splice_rows(
|
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
|
+
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'
|