name-tamer 0.2.12 → 0.2.13
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/Gemfile.lock +1 -1
- data/doc/suffixes.csv +1 -0
- data/lib/name-tamer.rb +2 -2
- data/lib/name-tamer/version.rb +1 -1
- data/lib/string_extras.rb +18 -2
- data/spec/name_tamer_spec.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c5e99cd91c6b72b1d5a3ca7b25470186cd28cd4
|
4
|
+
data.tar.gz: 2e2b4d0f7f5fdc15574b43fd25020b3d0903e10a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: deccabf459b385334a9ff09d47a969e63f6e935e6cada7e7215fd46bf3e2a7b5609ec618719c786688a5f6bd13e30df7cab5dd5c9433ad4984dcfd334410a7e5
|
7
|
+
data.tar.gz: 50fa04727ae320b85c136ae529166c7f1ced91ad5a89900e0ed0571c486b901d2809487868d2b3b6e6923937b715df2280bf966adb913784ef1319ee4834598b
|
data/Gemfile.lock
CHANGED
data/doc/suffixes.csv
CHANGED
@@ -215,6 +215,7 @@ B.Tech.,Bachelor of Technology,person,100,,7
|
|
215
215
|
D.Phil.,Doctor of Philosophy,person,100,,7
|
216
216
|
B.Eng.,Bachelor of Engineering,person,100,,6
|
217
217
|
C.F.A.,,person,100,,6
|
218
|
+
C.L.P.,,person,100,,6
|
218
219
|
D.B.E.,Dame of the British Empire,person,100,,6
|
219
220
|
D.D.S.,Doctor of Dental Surgery,person,100,,6
|
220
221
|
Eng.D.,Doctor of Engineering,person,100,,6
|
data/lib/name-tamer.rb
CHANGED
@@ -140,7 +140,7 @@ class NameTamer
|
|
140
140
|
|
141
141
|
def tidy_spacing
|
142
142
|
@tidy_name
|
143
|
-
.
|
143
|
+
.space_around_comma!
|
144
144
|
.strip_or_self!
|
145
145
|
.whitespace_to!(ASCII_SPACE)
|
146
146
|
end
|
@@ -462,7 +462,7 @@ class NameTamer
|
|
462
462
|
'Chartered F.C.S.I.',
|
463
463
|
'C.I.S.S.P.', 'T.M.I.E.T.', 'A.C.C.A.', 'C.I.T.P.', 'F.B.C.S.', 'F.C.C.A.', 'F.C.M.I.', 'F.I.E.T.', 'F.I.R.P.',
|
464
464
|
'M.I.E.T.', 'B.Tech.',
|
465
|
-
'Cantab.', 'D.Phil.', 'I.T.I.L. v3', 'B.Eng.', 'C.Eng.', 'M.Jur.', 'C.F.A.', 'D.B.E.',
|
465
|
+
'Cantab.', 'D.Phil.', 'I.T.I.L. v3', 'B.Eng.', 'C.Eng.', 'M.Jur.', 'C.F.A.', 'D.B.E.', 'C.L.P.',
|
466
466
|
'D.D.S.', 'D.V.M.', 'Eng.D.', 'A.C.A.', 'C.T.A.', 'E.R.P.', 'F.C.A', 'F.P.C.', 'F.R.M.', 'M.B.A.', 'M.B.E.',
|
467
467
|
'M.E.P.', 'M.Eng.', 'M.Jur.', 'M.S.P.', 'O.B.E.', 'P.M.C.', 'P.M.P.', 'P.S.P.', 'V.M.D.', 'B.Ed.', 'B.Sc.',
|
468
468
|
'Ed.D.', 'Hons.', 'LL.B.',
|
data/lib/name-tamer/version.rb
CHANGED
data/lib/string_extras.rb
CHANGED
@@ -15,8 +15,8 @@ class String
|
|
15
15
|
end
|
16
16
|
|
17
17
|
# Ensure commas have exactly one space after them
|
18
|
-
def
|
19
|
-
substitute!(
|
18
|
+
def space_around_comma!
|
19
|
+
substitute!(/[[:space:]]*,[[:space:]]*/, ', ')
|
20
20
|
end
|
21
21
|
|
22
22
|
# Change some characters embedded in words to our separator character
|
@@ -243,4 +243,20 @@ class String
|
|
243
243
|
}
|
244
244
|
|
245
245
|
BAD_ENCODING_PATTERNS = /(#{BAD_ENCODING.keys.join('|')})/
|
246
|
+
|
247
|
+
# Colorize strings
|
248
|
+
colors = %w(black red green yellow blue magenta cyan white)
|
249
|
+
|
250
|
+
colors.each_with_index do |fg_color, i|
|
251
|
+
fg = 30 + i
|
252
|
+
define_method(fg_color) { ansi_attributes(fg) }
|
253
|
+
|
254
|
+
colors.each_with_index do |bg_color, j|
|
255
|
+
define_method("#{fg_color}_on_#{bg_color}") { ansi_attributes(fg, 40 + j) }
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
def ansi_attributes(*args)
|
260
|
+
"\e[#{args.join(';')}m#{self}\e[0m"
|
261
|
+
end
|
246
262
|
end
|
data/spec/name_tamer_spec.rb
CHANGED
@@ -189,7 +189,9 @@ describe NameTamer do
|
|
189
189
|
{ n: "\xc3\x28", t: :person, nn: '()', sn: '()', s: '_' }, # Invalid byte sequence in UTF-8
|
190
190
|
{ n: '’%80', t: :person, nn: '’%80', sn: '’%80', s: '’80' }, # Encoding::CompatibilityError
|
191
191
|
{ n: "John Smith\u{FEFF}\u{200B}\u{200C}\u{200D}\u{2063}", t: :person,
|
192
|
-
nn: 'John Smith', sn: 'John Smith', s: 'john-smith' } # Zero-width characters
|
192
|
+
nn: 'John Smith', sn: 'John Smith', s: 'john-smith' }, # Zero-width characters
|
193
|
+
{ n: 'Herman Melville ,CLP', t: :person, nn:'Herman Melville', sn:'Herman Melville', s:'herman-melville'},
|
194
|
+
{ n: 'Melville ,Herman', t: :person, nn:'Herman Melville', sn:'Herman Melville', s:'herman-melville'},
|
193
195
|
]
|
194
196
|
end
|
195
197
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: name-tamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xenapto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|