name-tamer 0.2.12 → 0.2.13

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: 6f4689a4c9b95c1017a5de365006feae82923b9d
4
- data.tar.gz: 21d381bff9387ec68c8ae5cae7fec9626d6f86d8
3
+ metadata.gz: 2c5e99cd91c6b72b1d5a3ca7b25470186cd28cd4
4
+ data.tar.gz: 2e2b4d0f7f5fdc15574b43fd25020b3d0903e10a
5
5
  SHA512:
6
- metadata.gz: 6cad473425ca6ca0cd50e40d9356ffd0b14ac5abb429ef1869da05ce4de2e2255a17ca30a0e7de637018d683a6460bbfbeb1b99f38126b7900d05572e9268947
7
- data.tar.gz: 97871688a2a156dbaa4753defebdf89b19fc11679ca08a3fd6ba4c0caaa6edd71cfa7bc0c1a0a6b6be32431d3d96d5a7763ee5f32418997b19dec1c113649a09
6
+ metadata.gz: deccabf459b385334a9ff09d47a969e63f6e935e6cada7e7215fd46bf3e2a7b5609ec618719c786688a5f6bd13e30df7cab5dd5c9433ad4984dcfd334410a7e5
7
+ data.tar.gz: 50fa04727ae320b85c136ae529166c7f1ced91ad5a89900e0ed0571c486b901d2809487868d2b3b6e6923937b715df2280bf966adb913784ef1319ee4834598b
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- name-tamer (0.2.7)
4
+ name-tamer (0.2.12)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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
@@ -140,7 +140,7 @@ class NameTamer
140
140
 
141
141
  def tidy_spacing
142
142
  @tidy_name
143
- .space_after_comma!
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.',
@@ -1,3 +1,3 @@
1
1
  class NameTamer
2
- VERSION = '0.2.12'
2
+ VERSION = '0.2.13'
3
3
  end
@@ -15,8 +15,8 @@ class String
15
15
  end
16
16
 
17
17
  # Ensure commas have exactly one space after them
18
- def space_after_comma!
19
- substitute!(/,[[:space:]]*/, ', ')
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
@@ -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.12
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-01-21 00:00:00.000000000 Z
11
+ date: 2015-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler