human_name_parser 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/human_name_parser.gemspec +1 -0
- data/lib/human_name_parser/name.rb +2 -2
- data/lib/human_name_parser/version.rb +1 -1
- data/spec/name_spec.rb +11 -0
- metadata +19 -5
data/human_name_parser.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module HumanNameParser
|
2
2
|
class Name
|
3
3
|
PREFIXES = ['mr', 'ms', 'miss', 'mrs', 'sir', 'prof', 'professor', 'md', 'dr']
|
4
|
-
SUFFIXES = ['esq','esquire','jr','sr','2','ii','iii','iv']
|
4
|
+
SUFFIXES = ['esq','esquire','jr','sr','2','ii','iii','iv', 'v', 'phd', 'md', 'do', 'dc', 'dds']
|
5
5
|
LAST_PREFIXES = ['al', 'bar','ben','bin','da','dal','de la', 'de', 'del', 'der', 'di', 'el', 'ibn', 'la', 'le', 'mc', 'san', 'st', 'ste', 'van', 'van der', 'van den', 'vel','von']
|
6
6
|
|
7
7
|
attr_accessor :first, :middle, :last, :prefix, :suffix
|
@@ -27,7 +27,7 @@ module HumanNameParser
|
|
27
27
|
self.last = ''
|
28
28
|
elsif @split_name.length == 2
|
29
29
|
_first, _last = @split_name
|
30
|
-
self.first =
|
30
|
+
self.first = _firstjk
|
31
31
|
self.last = _last
|
32
32
|
else
|
33
33
|
parse_prefix.
|
data/spec/name_spec.rb
CHANGED
@@ -12,6 +12,17 @@ describe HumanNameParser::Name do
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
context "when full name is Marley Mante PhD" do
|
16
|
+
let(:full_name) { "Marley Mante PhD" }
|
17
|
+
it "should parse the name" do
|
18
|
+
@name = HumanNameParser::Name.new full_name
|
19
|
+
@name.first.should == 'Marley'
|
20
|
+
@name.last.should == 'Mante'
|
21
|
+
@name.middle.should == ''
|
22
|
+
@name.suffix.should == 'PhD'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
15
26
|
context 'when full name is Mary Lou Smith' do
|
16
27
|
let(:full_name) { "Mary Lou Smith" }
|
17
28
|
before do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: human_name_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adam Bachman
|
@@ -15,11 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-11-
|
18
|
+
date: 2011-11-11 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
22
|
+
name: rake
|
23
23
|
prerelease: false
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
@@ -32,6 +32,20 @@ dependencies:
|
|
32
32
|
version: "0"
|
33
33
|
type: :development
|
34
34
|
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rspec
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id002
|
35
49
|
description: human_name_parser is intended to split names into their component parts.
|
36
50
|
email:
|
37
51
|
- adam.bachman@gmail.com
|