people_places_things 2.3.1 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +2 -0
- data/lib/people_places_things.rb +1 -1
- data/lib/people_places_things/person_name.rb +9 -4
- data/people_places_things.gemspec +3 -3
- data/spec/person_name_spec.rb +8 -0
- metadata +12 -5
data/README.textile
CHANGED
@@ -4,6 +4,8 @@ PeoplePlacesThings is a collection of ruby classes for parsing and formatting U.
|
|
4
4
|
|
5
5
|
<pre><code>gem install -s http://gemcutter.org people_places_things</code></pre>
|
6
6
|
|
7
|
+
Rdocs available at "http://rdoc.info/projects/dburkes/people_places_things":http://rdoc.info/projects/dburkes/people_places_things
|
8
|
+
|
7
9
|
h2. Using PeoplePlacesThings
|
8
10
|
|
9
11
|
<pre><code>
|
data/lib/people_places_things.rb
CHANGED
@@ -18,7 +18,7 @@ module PeoplePlacesThings
|
|
18
18
|
else
|
19
19
|
case fmt
|
20
20
|
when :first_middle_last
|
21
|
-
if parts.size > 2
|
21
|
+
if parts.size > 2 && SUPPORTED_SUFFIXES.detect {|s| s.casecmp(parts.last) == 0}
|
22
22
|
self.suffix = PersonName.normalize_suffix(parts.last)
|
23
23
|
parts.delete_at(parts.size - 1)
|
24
24
|
end
|
@@ -41,9 +41,14 @@ module PeoplePlacesThings
|
|
41
41
|
parts.delete_at(1)
|
42
42
|
end
|
43
43
|
|
44
|
-
if parts.size > 2
|
45
|
-
|
46
|
-
|
44
|
+
if parts.size > 2
|
45
|
+
if SUPPORTED_SUFFIXES.detect {|s| s.casecmp(parts[1]) == 0}
|
46
|
+
self.suffix = PersonName.normalize_suffix(parts[1])
|
47
|
+
parts.delete_at(1)
|
48
|
+
elsif SUPPORTED_SUFFIXES.detect {|s| s.casecmp(parts.last) == 0}
|
49
|
+
self.suffix = PersonName.normalize_suffix(parts.last)
|
50
|
+
parts = parts[0..-2]
|
51
|
+
end
|
47
52
|
end
|
48
53
|
|
49
54
|
self.first = parts[1] if parts.size > 1
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{people_places_things}
|
8
|
-
s.version = "2.
|
8
|
+
s.version = "2.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Danny Burkes"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-03-03}
|
13
13
|
s.description = %q{Parsers and formatters for person names, street addresses, city/state/zip, phone numbers, etc.}
|
14
14
|
s.email = %q{dburkes@netable.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -44,7 +44,7 @@ Gem::Specification.new do |s|
|
|
44
44
|
s.homepage = %q{http://github.com/dburkes/people_places_things}
|
45
45
|
s.rdoc_options = ["--charset=UTF-8"]
|
46
46
|
s.require_paths = ["lib"]
|
47
|
-
s.rubygems_version = %q{1.3.
|
47
|
+
s.rubygems_version = %q{1.3.6}
|
48
48
|
s.summary = %q{Parsers and formatters for person names, street addresses, city/state/zip, phone numbers, etc.}
|
49
49
|
s.test_files = [
|
50
50
|
"spec/ansi_counties_spec.rb",
|
data/spec/person_name_spec.rb
CHANGED
@@ -45,6 +45,14 @@ describe PersonName do
|
|
45
45
|
name.suffix.should == 'jr'
|
46
46
|
end
|
47
47
|
|
48
|
+
it "should parse last first middle suffix" do
|
49
|
+
name = PersonName.new "peabody, george f., jr.", :last_first_middle
|
50
|
+
name.first.should == 'george'
|
51
|
+
name.middle.should == 'f.'
|
52
|
+
name.last.should == 'peabody'
|
53
|
+
name.suffix.should == 'jr'
|
54
|
+
end
|
55
|
+
|
48
56
|
it "should default to first_middle_last" do
|
49
57
|
name = PersonName.new "george quincy drake peabody"
|
50
58
|
name.first.should == 'george'
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: people_places_things
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 2
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
version: 2.4.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Danny Burkes
|
@@ -9,7 +14,7 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-03-03 00:00:00 -08:00
|
13
18
|
default_executable:
|
14
19
|
dependencies: []
|
15
20
|
|
@@ -59,18 +64,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
59
64
|
requirements:
|
60
65
|
- - ">="
|
61
66
|
- !ruby/object:Gem::Version
|
67
|
+
segments:
|
68
|
+
- 0
|
62
69
|
version: "0"
|
63
|
-
version:
|
64
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
72
|
- - ">="
|
67
73
|
- !ruby/object:Gem::Version
|
74
|
+
segments:
|
75
|
+
- 0
|
68
76
|
version: "0"
|
69
|
-
version:
|
70
77
|
requirements: []
|
71
78
|
|
72
79
|
rubyforge_project:
|
73
|
-
rubygems_version: 1.3.
|
80
|
+
rubygems_version: 1.3.6
|
74
81
|
signing_key:
|
75
82
|
specification_version: 3
|
76
83
|
summary: Parsers and formatters for person names, street addresses, city/state/zip, phone numbers, etc.
|