cijef-fullname-matcher 2.1.0 → 2.1.1

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: 9646dbbebcb213f077c80bfe00b1963f6a52e675
4
- data.tar.gz: c314c6567c47e03a5f321e4cf1a54fc617b07b14
3
+ metadata.gz: 52ca7d5a38684258b4a0751f38ef97c28b480f21
4
+ data.tar.gz: 6df28e86affd0ade3cdfb1c9fe2f13a6348234e8
5
5
  SHA512:
6
- metadata.gz: '084f921b2461829b5aad9d6d809e3d21d56b47fb03dd739e47c244013f31c806251753202a712002e9b6f12700d3be264ebd981daab9bd1384a03f0a6d9501fa'
7
- data.tar.gz: 707c846e6e1f1e5865feab68524cbf7419c0a673679c29bd0718bb95a590a30a4ee69d049ea9dc9f879f91ce53c31fb9c9f372efc4f7ea432eeb4ff3dd0c53e1
6
+ metadata.gz: 99b2cfc7a3cb4e519921725743316e422de294120587891ce3b9bd0d02833540312311bb575c8fef37526fa4e25221e50c34804cc662c19cbc702cd28c7f77b6
7
+ data.tar.gz: 1ca0631e8fce8d6a2f24080527cf838b60657358b7672085f7ba8f0fcd1604a0ce90ce9dfb273cec426e14fd1d944b2dd33f16beba7078171c50556f37745685
@@ -32,7 +32,8 @@ module Fullname::Matcher
32
32
  DEFAULT_OPTIONS = {
33
33
  :skip_match_middle_name => false, # skip match middle name if middle name not provided.
34
34
  :null_middle_name_match_allowed => false,
35
- :skip_match_suffix => false # skip match suffix if suffix not provided or no column suffix in database.
35
+ :skip_match_suffix => false, # skip match suffix if suffix not provided or no column suffix in database.
36
+ :null_suffix_match_allowed => false
36
37
  }
37
38
 
38
39
  class Error < StandardError ; end
@@ -75,7 +76,7 @@ module Fullname::Matcher
75
76
  exact_match_list = match_list.select do |r|
76
77
  compare_without_dot(r.send(@mapping[:middle]), name[:middle]) && compare_without_dot(r.send(@mapping[:suffix]), name[:suffix])
77
78
  end
78
- return exact_match_list if exact_match_list.size > 0 && @options[:null_middle_name_match_allowed] == false
79
+ #return exact_match_list if exact_match_list.size > 0 && @options[:null_middle_name_match_allowed] == false && @options[:null_suffix_match_allowed] == false
79
80
 
80
81
  # 2. if name[:middle] is not NULL, regexp match
81
82
  if name[:middle]
@@ -92,7 +93,7 @@ module Fullname::Matcher
92
93
  match_list = []
93
94
  else
94
95
  # 2.2 fuzzy match: assume all matches since name[:middle] is NULL
95
- return match_list
96
+ return (@options[:null_middle_name_match_allowed] == false && @options[:null_suffix_match_allowed] == false) ? exact_match_list : match_list
96
97
  end
97
98
  end
98
99
 
@@ -170,12 +171,12 @@ module Fullname::Matcher
170
171
 
171
172
  # exactly match suffix
172
173
  if name[:suffix].present?
173
- matched_list_with_suffix = matched_list.select{|r| compare_without_dot(r.send(@mapping[:suffix]), name[:suffix]) }
174
+ matched_list_with_suffix = matched_list.select{|r| (compare_without_dot(r.send(@mapping[:suffix]), name[:suffix]) || (r.send(@mapping[:suffix]).blank? && @options[:null_suffix_match_allowed])) }
174
175
  return matched_list_with_suffix if matched_list_with_suffix.size > 0
175
176
  end
176
177
 
177
178
  # fuzzy match suffix( NULL matches NON-NULL )
178
- return matched_list.select{|r| r.send(@mapping[:suffix]).to_s.strip.empty? || name[:suffix].nil? }
179
+ # return matched_list.select{|r| r.send(@mapping[:suffix]).to_s.strip.empty? || name[:suffix].nil? }
179
180
 
180
181
  end
181
182
  return matched_list
@@ -1,5 +1,5 @@
1
1
  module Fullname
2
2
  module Matcher
3
- VERSION = '2.1.0'
3
+ VERSION = '2.1.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cijef-fullname-matcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - yegang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-27 00:00:00.000000000 Z
11
+ date: 2019-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fullname-parser