name-tamer 0.1.4 → 0.1.5

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
  SHA1:
3
- metadata.gz: efc79a2d297ca97447620a9f2cfa839667108a1d
4
- data.tar.gz: 98022db00b0fccf4e7d2090d7e2883b8ae6239bd
3
+ metadata.gz: 5ab141545fd0a40633767d4bbec43fd9170a4023
4
+ data.tar.gz: c2ad25c3863f39082990e4cb1d2c51c2edae8456
5
5
  SHA512:
6
- metadata.gz: b100a7a8944c5ab4beade888f8d17be2d7547c84857301bba3ecf78862df3445844e9228fe1dbbedf15305f47c4c849d880e871f661452b39de2ff94885e2dfe
7
- data.tar.gz: aedb38fce8a533cea1c3d5d615c66bf985b57a106c91a30363b1c678d99a8e631aaa8fdae1477bd6ef78fca33b03025ea499c2ee67175e8130554e0f93b71945
6
+ metadata.gz: 63b3be31c544c28c1de9d9ce0faa243622438db313701273fcf382799bef138d11588841811f16cc7b85df016b3cbdf8e9a79fd69282104ccf8dc907a6dbef2b
7
+ data.tar.gz: cf0cfeaa251ea8942f43d91ba75abb41575a9476f2907735b0b285ada2c5dfc42326d550b17c125fb463e372b9e31d38705d88a958f61de9a00054b5879511b4
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- name-tamer (0.1.3)
4
+ name-tamer (0.1.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -13,24 +13,26 @@ GEM
13
13
  term-ansicolor
14
14
  thor
15
15
  diff-lcs (1.2.5)
16
+ docile (1.1.5)
16
17
  gem-release (0.7.3)
17
18
  mime-types (2.3)
18
19
  multi_json (1.10.1)
19
20
  rake (10.3.2)
20
21
  rest-client (1.6.7)
21
22
  mime-types (>= 1.16)
22
- rspec (2.14.1)
23
- rspec-core (~> 2.14.0)
24
- rspec-expectations (~> 2.14.0)
25
- rspec-mocks (~> 2.14.0)
26
- rspec-core (2.14.8)
27
- rspec-expectations (2.14.5)
23
+ rspec (2.99.0)
24
+ rspec-core (~> 2.99.0)
25
+ rspec-expectations (~> 2.99.0)
26
+ rspec-mocks (~> 2.99.0)
27
+ rspec-core (2.99.1)
28
+ rspec-expectations (2.99.1)
28
29
  diff-lcs (>= 1.1.3, < 2.0)
29
- rspec-mocks (2.14.6)
30
- simplecov (0.7.1)
31
- multi_json (~> 1.0)
32
- simplecov-html (~> 0.7.1)
33
- simplecov-html (0.7.1)
30
+ rspec-mocks (2.99.1)
31
+ simplecov (0.8.2)
32
+ docile (~> 1.1.0)
33
+ multi_json
34
+ simplecov-html (~> 0.8.0)
35
+ simplecov-html (0.8.0)
34
36
  term-ansicolor (1.3.0)
35
37
  tins (~> 1.0)
36
38
  thor (0.19.1)
@@ -42,10 +42,10 @@ class NameTamer
42
42
  unless @simple_name
43
43
  @simple_name = nice_name.dup # Start with nice name
44
44
 
45
- remove_initials # "John Q. Doe" -> "John Doe"
46
- remove_middle_names # "Philip Seymour Hoffman" -> "Philip Hoffman"
47
- remove_dots_from_abbreviations # "J.P.R. Williams" -> "JPR Williams"
48
- standardize_words # "B&Q Intl" -> "B and Q International"
45
+ remove_initials # "John Q. Doe" -> "John Doe"
46
+ remove_middle_names # "Philip Seymour Hoffman" -> "Philip Hoffman"
47
+ remove_periods_from_initials # "J.P.R. Williams" -> "JPR Williams"
48
+ standardize_words # "B&Q Intl" -> "B and Q International"
49
49
 
50
50
  @simple_name.whitespace_to!(ASCII_SPACE)
51
51
  end
@@ -236,14 +236,15 @@ class NameTamer
236
236
  @simple_name = "#{first_name}#{separator}#{last_name}"
237
237
  end
238
238
 
239
- def remove_dots_from_abbreviations
240
- @simple_name.gsub!(/\b([a-z])\./i) { |_match| Regexp.last_match[1] }
239
+ def remove_periods_from_initials
240
+ @simple_name.remove_periods_from_initials!
241
241
  end
242
242
 
243
243
  def standardize_words
244
244
  @simple_name.gsub!(/ *& */, ' and ') # replace ampersand characters with ' and '
245
245
  @simple_name.gsub!(/ *\+ */, ' plus ') # replace plus signs with ' plus '
246
246
  @simple_name.gsub!(/\bintl\b/i, 'International') # replace 'intl' with 'International'
247
+ @simple_name.gsub!(/["“”]/, '') # remove quotes
247
248
  end
248
249
 
249
250
  #--------------------------------------------------------
@@ -1,3 +1,3 @@
1
1
  class NameTamer
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
@@ -129,6 +129,11 @@ class String
129
129
  self # Allows chaining
130
130
  end
131
131
 
132
+ def remove_periods_from_initials!
133
+ self.gsub!(/\b([a-z])\./i) { |_| Regexp.last_match[1] }
134
+ self # Allows chaining
135
+ end
136
+
132
137
  def remove_spaces_from_initials!
133
138
  self.gsub!(/\b([a-z])(\.)* \b(?![a-z0-9']{2,})/i) { |_| "#{Regexp.last_match[1]}#{Regexp.last_match[2]}" }
134
139
  self # Allows chaining
@@ -139,7 +139,7 @@ describe NameTamer do
139
139
  { n: '* Shorusan *', t: :organization, nn: '* Shorusan *', sn: '* Shorusan *', s: 'shorusan' },
140
140
  { n: '项目谷', t: :organization, nn: '项目谷', sn: '项目谷', s: '项目谷' },
141
141
  { n: 'ООО "Инновационные полимерные адгезивы"', t: :organization, nn: 'ООО "Инновационные полимерные адгезивы"',
142
- sn: 'ООО "Инновационные полимерные адгезивы"', s: 'ООО-Инновационные-полимерные-адгезивы' },
142
+ sn: 'ООО Инновационные полимерные адгезивы', s: 'ООО-Инновационные-полимерные-адгезивы' },
143
143
  { n: 'عبدالله ...', t: :organization, nn: 'عبدالله ...', sn: 'عبدالله ...', s: 'عبدالله' },
144
144
  { n: 'กมลชนก ทิศไธสง', t: :organization, nn: 'กมลชนก ทิศไธสง', sn: 'กมลชนก ทิศไธสง', s: 'กมลชนก-ทิศไธสง' },
145
145
  { n: 'יוֹ אָב', t: :organization, nn: 'יוֹ אָב', sn: 'יוֹ אָב', s: 'יוֹ-אָב' },
@@ -164,6 +164,8 @@ describe NameTamer do
164
164
  { n: '* *', t: :person, nn: '* *', sn: '* *', s: '_' },
165
165
  { n: '* Olga *', t: :person, nn: '* Olga *', sn: 'Olga', s: 'olga' },
166
166
  { n: '* Olga Bedia García *', t: :person, nn: '* Olga Bedia García *', sn: 'Olga García', s: 'olga-garcia' },
167
+ { n: 'Jose “Pepe” García', t: :organization, nn: 'Jose “Pepe” García', sn: 'Jose Pepe García',
168
+ s: 'jose-pepe-garcia' },
167
169
  { n: 'John Smith M.A. (Oxon)', t: :person, nn: 'John Smith', sn: 'John Smith', s: 'john-smith' },
168
170
  { n: 'I B M', t: :organization, nn: 'Ibm', sn: 'Ibm', s: 'ibm' },
169
171
  { n: 'I-B-M', t: :organization, nn: 'I-B-M', sn: 'I-B-M', s: 'i-b-m' },
@@ -12,7 +12,7 @@ RSpec.configure do |config|
12
12
  config.order = 'random'
13
13
 
14
14
  # Manually-added
15
- config.color_enabled = true
15
+ config.color = true
16
16
  config.tty = true
17
17
  config.formatter = :documentation
18
18
  end
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.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xenapto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-22 00:00:00.000000000 Z
11
+ date: 2014-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler