mericson-people 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/people.rb +11 -6
- data/people.gemspec +45 -0
- metadata +2 -1
data/VERSION.yml
CHANGED
data/lib/people.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
module People
|
2
|
-
|
2
|
+
|
3
3
|
class NameParser
|
4
4
|
|
5
|
+
|
6
|
+
attr_reader :seen, :parsed
|
7
|
+
|
5
8
|
def initialize( opts={} )
|
6
|
-
|
9
|
+
|
7
10
|
@name_chars = "A-Za-z0-9\\-\\'"
|
8
11
|
@nc = @name_chars
|
9
|
-
|
12
|
+
|
10
13
|
@opts = {
|
11
14
|
:strip_mr => true,
|
12
15
|
:strip_mrs => false,
|
@@ -148,6 +151,8 @@ module People
|
|
148
151
|
|
149
152
|
out[:orig] = name.dup
|
150
153
|
|
154
|
+
name = name.dup
|
155
|
+
|
151
156
|
name = clean( name )
|
152
157
|
|
153
158
|
# strip trailing suffices
|
@@ -170,7 +175,7 @@ module People
|
|
170
175
|
if @opts[:couples]
|
171
176
|
name.gsub!( / +and +/i, " \& " )
|
172
177
|
end
|
173
|
-
|
178
|
+
|
174
179
|
|
175
180
|
|
176
181
|
if @opts[:couples] && name.match( /\&/ )
|
@@ -298,7 +303,7 @@ module People
|
|
298
303
|
@titles.each do |title|
|
299
304
|
title_p = Regexp.new( "^(#{title})(.+)", true )
|
300
305
|
if m = name.match( title_p )
|
301
|
-
|
306
|
+
|
302
307
|
title = m[1]
|
303
308
|
name.replace( m[-1].strip )
|
304
309
|
return title
|
@@ -450,7 +455,7 @@ module People
|
|
450
455
|
# Exclude names ending in a,c,i,o,z or j, typically Polish or Italian
|
451
456
|
|
452
457
|
if fixed.match( /\bMac[a-z]{2,}[^a|c|i|o|z|j]\b/i )
|
453
|
-
|
458
|
+
|
454
459
|
fixed.gsub!( /\b(Mac)([a-z]+)/i ) do |m|
|
455
460
|
$1 + $2.capitalize
|
456
461
|
end
|
data/people.gemspec
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{people}
|
5
|
+
s.version = "0.1.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Matthew Ericson"]
|
9
|
+
s.date = %q{2009-04-14}
|
10
|
+
s.email = %q{mericson@ericson.net}
|
11
|
+
s.extra_rdoc_files = [
|
12
|
+
"LICENSE",
|
13
|
+
"README.rdoc"
|
14
|
+
]
|
15
|
+
s.files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc",
|
18
|
+
"Rakefile",
|
19
|
+
"VERSION.yml",
|
20
|
+
"lib/people.rb",
|
21
|
+
"people.gemspec",
|
22
|
+
"test/people_test.rb",
|
23
|
+
"test/test_helper.rb"
|
24
|
+
]
|
25
|
+
s.has_rdoc = true
|
26
|
+
s.homepage = %q{http://github.com/mericson/people}
|
27
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
28
|
+
s.require_paths = ["lib"]
|
29
|
+
s.rubygems_version = %q{1.3.1}
|
30
|
+
s.summary = %q{Matts Name Parser}
|
31
|
+
s.test_files = [
|
32
|
+
"test/people_test.rb",
|
33
|
+
"test/test_helper.rb"
|
34
|
+
]
|
35
|
+
|
36
|
+
if s.respond_to? :specification_version then
|
37
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
38
|
+
s.specification_version = 2
|
39
|
+
|
40
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
41
|
+
else
|
42
|
+
end
|
43
|
+
else
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mericson-people
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Ericson
|
@@ -28,6 +28,7 @@ files:
|
|
28
28
|
- Rakefile
|
29
29
|
- VERSION.yml
|
30
30
|
- lib/people.rb
|
31
|
+
- people.gemspec
|
31
32
|
- test/people_test.rb
|
32
33
|
- test/test_helper.rb
|
33
34
|
has_rdoc: true
|