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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e591eff0f6b945e8d28537d3c3bbfa0d96bd5112a3c4c523165ab82ae33ebc1
4
- data.tar.gz: 4c792884b907c9f13282dd70b2c36f5e6cf2890003f9ce6526673c5997672300
3
+ metadata.gz: 277ac5eb79893e74c62db5776c541b89cb676f13136ed71b2862d9850555fcc4
4
+ data.tar.gz: 00fe1bb715cc7e5e4065e5dc94ec37dc9b229e17623c8105b960b1619a3a665a
5
5
  SHA512:
6
- metadata.gz: 3c144bbdd14138152c909bdba39ff6f9694a8d4339a187e4f050c2ea5b4dfeeec18c210fb3832c8031e3acc30a6073d6c06cba8a41bc58b8023d95660f7b4958
7
- data.tar.gz: 87abf7022b4f36048896f8a8a30b44b5b1e06629b3ab5813a93ed469ca0e00ed5eb0638a9fb2cc648d445f210ea77b20e3dbd69c06929d035f9616fb95a7792f
6
+ metadata.gz: fe72b9e1dd173c20576ea663ee78549633532f0e1723335bc3d253d7d8a6181dc37e44702a8e263e84ae4c4c2076692975c8bdf970c2c4c46a4bc1743e019c6a
7
+ data.tar.gz: b053e078e0b9160c6af044ad42c35baf20d3857966cec89f71d05c52bda398ad26ed0334c01b0be104ff0e8fa3f657237432e84c3e9f206fc049ead37a22f302
@@ -1,4 +1,5 @@
1
1
  ---
2
+ - [Duro, Duero]
2
3
  - [Ffrench, French]
3
4
  - [Murchadha, Murphy]
4
5
  - [Quinn, Benjamin, !ruby/regexp /^(Debbie|Deborah)$/]
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
- data = File.open(file) { |fd| YAML.load(fd) }
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ICU
4
4
  class Name
5
- VERSION = "1.2.5"
5
+ VERSION = "1.3.0"
6
6
  end
7
7
  end
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
- data = File.open(file) { |fd| YAML.load(fd) }
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.2.5
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: 2019-02-03 00:00:00.000000000 Z
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: mark.j.l.orr@googlemail.com
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
- rubyforge_project: icu_name
111
- rubygems_version: 2.7.8
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: []