icu_name 1.2.1 → 1.2.2

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.
@@ -151,7 +151,8 @@ module ICU
151
151
 
152
152
  # Apply final touches to finish canonicalising a first name.
153
153
  def finish_first(names)
154
- names.gsub(/([A-Z\u{c0}-\u{de}])\b/, '\1.')
154
+ names.gsub!(/([A-Z\u{c0}-\u{de}])\b/) { $1 + '.' } # Mark J L => Mark J. L.
155
+ names.gsub(/\b(I(v|ii?))\b/) { $1.upcase } # Richard Iii => Richard III
155
156
  end
156
157
 
157
158
  # Apply final touches to finish canonicalising a last name.
@@ -164,6 +165,7 @@ module ICU
164
165
  'Mac'.concat(@original.match(/\bMac#{upper}/) ? upper : letter)
165
166
  end
166
167
  names.gsub!(/\bO ([A-Z\u{c0}-\u{de}])/) { |m| "O'" + $1 } # O Kelly => "O'Kelly"
168
+ names.gsub!(/\b(I(v|ii?))\b/) { $1.upcase } # Ford iv => Ford IV
167
169
  names
168
170
  end
169
171
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ICU
4
4
  class Name
5
- VERSION = "1.2.1"
5
+ VERSION = "1.2.2"
6
6
  end
7
7
  end
@@ -160,6 +160,14 @@ module ICU
160
160
  end
161
161
  end
162
162
 
163
+ context "names with II, III or IV" do
164
+ it "should be handled correctly" do
165
+ Name.new('Jerry iIi', 'Jones').name.should == 'Jerry III Jones'
166
+ Name.new('henry i', 'FORD II').name.should == 'Henry I. Ford II'
167
+ Name.new('Paul IV', 'Pope').name.should == 'Paul IV Pope'
168
+ end
169
+ end
170
+
163
171
  context "accented characters and capitalisation" do
164
172
  it "should downcase upper case accented characters where appropriate" do
165
173
  name = Name.new('GEARÓIDÍN', 'UÍ LAIGHLÉIS')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icu_name
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-23 00:00:00.000000000 Z
12
+ date: 2013-10-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -112,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  segments:
114
114
  - 0
115
- hash: 2495623935801790259
115
+ hash: -3363499622119163583
116
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements: