nameable 0.2.0 → 0.3.0
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.
- data/LICENSE +0 -0
- data/README.rdoc +0 -0
- data/Rakefile +0 -0
- data/TODO +0 -0
- data/lib/nameable.rb +2 -3
- data/nameable.gemspec +2 -2
- data/spec/nameable_spec.rb +17 -3
- data/spec/spec_helper.rb +10 -2
- metadata +20 -41
data/LICENSE
CHANGED
File without changes
|
data/README.rdoc
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/TODO
CHANGED
File without changes
|
data/lib/nameable.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2012 Chris Horn http://chorn.com/
|
2
2
|
# See MIT-LICENSE.txt
|
3
3
|
|
4
4
|
# TODO: Make this less sucky.
|
@@ -139,11 +139,10 @@ module Nameable
|
|
139
139
|
end
|
140
140
|
|
141
141
|
def parse(name)
|
142
|
+
raise InvalidNameError unless name
|
142
143
|
if name.class == String
|
143
144
|
if name.index(',')
|
144
145
|
name = "#{$2} #{$1}" if name =~ /^([a-z]+),(.*)/i
|
145
|
-
|
146
|
-
#name = "#{$2} #{$1}" if name =~ /^([a-z]+),(.*)/i
|
147
146
|
end
|
148
147
|
|
149
148
|
name = name.strip.split(/\s+/)
|
data/nameable.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "nameable"
|
3
|
-
s.version = "0.
|
4
|
-
s.date = "
|
3
|
+
s.version = "0.3.0"
|
4
|
+
s.date = "2012-01-17"
|
5
5
|
s.summary = "Provides parsing and output of person names."
|
6
6
|
s.email = "chorn@chorn.com"
|
7
7
|
s.homepage = "http://github.com/chorn/nameable"
|
data/spec/nameable_spec.rb
CHANGED
@@ -1,7 +1,21 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
|
5
|
-
|
3
|
+
describe Nameable::Latin do
|
4
|
+
describe "with 'Mr. Chris Horn PhD" do
|
5
|
+
subject { Nameable::Latin.new.parse("Mr. Chris Horn PhD") }
|
6
|
+
|
7
|
+
it("should extract prefix") { subject.prefix.should == "Mr." }
|
8
|
+
it("should extract first name") { subject.first.should == "Chris" }
|
9
|
+
it("should extract last name") { subject.last.should == "Horn" }
|
10
|
+
it("should extract and normalize suffix") { subject.suffix.should == "Ph.D." }
|
6
11
|
end
|
12
|
+
|
13
|
+
describe "with 'Chris Old Biscuit Barrel Horn'" do
|
14
|
+
subject { Nameable::Latin.new.parse("Chris Old Biscuit Barrel Horn") }
|
15
|
+
|
16
|
+
it("should extract first name") { subject.first.should == "Chris" }
|
17
|
+
it("should extract middle name") { subject.middle.should == "Old Biscuit Barrel" }
|
18
|
+
it("should extract last name") { subject.last.should == "Horn" }
|
19
|
+
end
|
20
|
+
|
7
21
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,2 +1,10 @@
|
|
1
|
-
$
|
2
|
-
|
1
|
+
$LOAD_PATH.push File.join(File.dirname(__FILE__), '..', 'lib')
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
require "spec"
|
5
|
+
require "active_support"
|
6
|
+
require "nameable"
|
7
|
+
|
8
|
+
Spec::Runner.configure do |config|
|
9
|
+
# config.mock_with :mocha
|
10
|
+
end
|
metadata
CHANGED
@@ -1,33 +1,22 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: nameable
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 0
|
10
|
-
version: 0.2.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Chris Horn
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2010-07-12 00:00:00 -04:00
|
19
|
-
default_executable:
|
12
|
+
date: 2012-01-17 00:00:00.000000000 Z
|
20
13
|
dependencies: []
|
21
|
-
|
22
14
|
description: A gem that provides parsing and output of person names.
|
23
15
|
email: chorn@chorn.com
|
24
16
|
executables: []
|
25
|
-
|
26
17
|
extensions: []
|
27
|
-
|
28
18
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
files:
|
19
|
+
files:
|
31
20
|
- LICENSE
|
32
21
|
- README.rdoc
|
33
22
|
- Rakefile
|
@@ -38,39 +27,29 @@ files:
|
|
38
27
|
- script/generate
|
39
28
|
- spec/nameable_spec.rb
|
40
29
|
- spec/spec_helper.rb
|
41
|
-
has_rdoc: true
|
42
30
|
homepage: http://github.com/chorn/nameable
|
43
31
|
licenses: []
|
44
|
-
|
45
32
|
post_install_message:
|
46
33
|
rdoc_options: []
|
47
|
-
|
48
|
-
require_paths:
|
34
|
+
require_paths:
|
49
35
|
- lib
|
50
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
37
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
|
56
|
-
|
57
|
-
- 0
|
58
|
-
version: "0"
|
59
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
43
|
none: false
|
61
|
-
requirements:
|
62
|
-
- -
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
|
65
|
-
segments:
|
66
|
-
- 0
|
67
|
-
version: "0"
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
68
48
|
requirements: []
|
69
|
-
|
70
49
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.
|
50
|
+
rubygems_version: 1.8.15
|
72
51
|
signing_key:
|
73
52
|
specification_version: 3
|
74
53
|
summary: Provides parsing and output of person names.
|
75
54
|
test_files: []
|
76
|
-
|
55
|
+
has_rdoc: true
|