icu_name 1.2.5 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/last_alternatives.yaml +1 -0
- data/lib/icu_name/name.rb +8 -1
- data/lib/icu_name/version.rb +1 -1
- data/spec/name_spec.rb +23 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 277ac5eb79893e74c62db5776c541b89cb676f13136ed71b2862d9850555fcc4
|
4
|
+
data.tar.gz: 00fe1bb715cc7e5e4065e5dc94ec37dc9b229e17623c8105b960b1619a3a665a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe72b9e1dd173c20576ea663ee78549633532f0e1723335bc3d253d7d8a6181dc37e44702a8e263e84ae4c4c2076692975c8bdf970c2c4c46a4bc1743e019c6a
|
7
|
+
data.tar.gz: b053e078e0b9160c6af044ad42c35baf20d3857966cec89f71d05c52bda398ad26ed0334c01b0be104ff0e8fa3f657237432e84c3e9f206fc049ead37a22f302
|
data/lib/icu_name/name.rb
CHANGED
@@ -66,6 +66,7 @@ module ICU
|
|
66
66
|
# Match another name to this object, returning true or false.
|
67
67
|
def match(name1='', name2='', opts={})
|
68
68
|
other = Name.new(name1, name2)
|
69
|
+
return true if name == other.name
|
69
70
|
match_first(first(opts), other.first(opts)) && match_last(last(opts), other.last(opts))
|
70
71
|
end
|
71
72
|
|
@@ -278,7 +279,13 @@ module ICU
|
|
278
279
|
return if @@alts[type] && !force
|
279
280
|
unless data
|
280
281
|
file = File.expand_path(File.dirname(__FILE__) + "/../../config/#{type}_alternatives.yaml")
|
281
|
-
|
282
|
+
if RUBY_VERSION >= "3"
|
283
|
+
data = File.open(file) { |fd| YAML.load(fd, permitted_classes: [Regexp]) }
|
284
|
+
else
|
285
|
+
data = File.open(file) { |fd| YAML.load(fd) }
|
286
|
+
end
|
287
|
+
|
288
|
+
|
282
289
|
end
|
283
290
|
@@cmps[type] ||= 0
|
284
291
|
@@alts[type] = Hash.new
|
data/lib/icu_name/version.rb
CHANGED
data/spec/name_spec.rb
CHANGED
@@ -7,7 +7,12 @@ module ICU
|
|
7
7
|
Name.reset_alternatives if reset
|
8
8
|
types.each do |type|
|
9
9
|
file = File.expand_path(File.dirname(__FILE__) + "/../config/test_#{type}_alts.yaml")
|
10
|
-
|
10
|
+
if RUBY_VERSION >= "3"
|
11
|
+
data = File.open(file) { |fd| YAML.load(fd, permitted_classes: [Regexp]) }
|
12
|
+
else
|
13
|
+
data = File.open(file) { |fd| YAML.load(fd) }
|
14
|
+
end
|
15
|
+
|
11
16
|
Name.load_alternatives(type, data)
|
12
17
|
end
|
13
18
|
end
|
@@ -168,6 +173,23 @@ module ICU
|
|
168
173
|
end
|
169
174
|
end
|
170
175
|
|
176
|
+
context "nil last name" do
|
177
|
+
before(:each) do
|
178
|
+
@sarthak1 = Name.new('Sarthak Bathla', nil)
|
179
|
+
@sarthak2 = Name.new("Sarthak", "Bathla")
|
180
|
+
@sarthak3 = Name.new("Sarthak Bathla", "")
|
181
|
+
end
|
182
|
+
|
183
|
+
it "should match concatenation of first and last name" do
|
184
|
+
[@sarthak1, @sarthak2, @sarthak3].each do |sarthak|
|
185
|
+
expect(sarthak.match("Sarthak", "Bathla")).to be_truthy
|
186
|
+
expect(sarthak.match("Sarthak Bathla", "")).to be_truthy
|
187
|
+
expect(sarthak.match("", "Sarthak Bathla")).to be_truthy
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
|
171
193
|
context "accented characters and capitalisation" do
|
172
194
|
it "should downcase upper case accented characters where appropriate" do
|
173
195
|
name = Name.new('GEARÓIDÍN', 'UÍ LAIGHLÉIS')
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icu_name
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- David Murray
|
7
8
|
- Mark Orr
|
8
|
-
autorequire:
|
9
|
+
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2023-01-03 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -68,7 +69,7 @@ dependencies:
|
|
68
69
|
version: '4.2'
|
69
70
|
description: Canonicalises and matches person names with Latin1 characters and first
|
70
71
|
and last names
|
71
|
-
email:
|
72
|
+
email: ratings@icu.ie
|
72
73
|
executables: []
|
73
74
|
extensions: []
|
74
75
|
extra_rdoc_files:
|
@@ -92,7 +93,7 @@ homepage: http://rubygems.org/gems/icu_name
|
|
92
93
|
licenses:
|
93
94
|
- MIT
|
94
95
|
metadata: {}
|
95
|
-
post_install_message:
|
96
|
+
post_install_message:
|
96
97
|
rdoc_options: []
|
97
98
|
require_paths:
|
98
99
|
- lib
|
@@ -107,9 +108,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
108
|
- !ruby/object:Gem::Version
|
108
109
|
version: 1.3.6
|
109
110
|
requirements: []
|
110
|
-
|
111
|
-
|
112
|
-
signing_key:
|
111
|
+
rubygems_version: 3.3.7
|
112
|
+
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Canonicalises and matches person names
|
115
115
|
test_files: []
|