sixarm_ruby_person_name 1.1.0 → 1.1.2
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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data/Rakefile +6 -4
- data/lib/sixarm_ruby_person_name/person_name.rb +122 -0
- data/test/sixarm_ruby_person_name_test/person_name_test.rb +227 -0
- data/test/sixarm_ruby_person_name_test.rb +9 -228
- data.tar.gz.sig +0 -0
- metadata +133 -53
- metadata.gz.sig +0 -0
- data/.gemtest +0 -0
- data/README.md +0 -129
- data/VERSION +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 62068afab4a563ea89d776bc33f52476a2d50d8a
|
4
|
+
data.tar.gz: 6987068ada1d2c58bee972baf9865bf3e1807089
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 928e5dfe5298146c1963dc695f3593d4aff705ded33ce1114e904c8e9edabff5e063bf9e5f376094d2f4113110b226c8ccaca3dc0e3c8277fea10b1965de2e71
|
7
|
+
data.tar.gz: 68ee19c6b5c6da4225906ac8abd8e0853b5d16f1935d094fa2c8130dedf892b04fd124e8f4634e891e152fae9c80815b5ae3d76b47d42023e86a0b2d5de367bc
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/Rakefile
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require "rake"
|
3
|
+
require "rake/testtask"
|
4
4
|
|
5
5
|
Rake::TestTask.new(:test) do |t|
|
6
|
-
t.libs
|
7
|
-
t.pattern =
|
6
|
+
t.libs.push("lib", "test")
|
7
|
+
t.pattern = "test/**/*.rb"
|
8
8
|
end
|
9
|
+
|
10
|
+
task :default => [:test]
|
@@ -0,0 +1,122 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
=begin rdoc
|
3
|
+
Please see README
|
4
|
+
=end
|
5
|
+
|
6
|
+
|
7
|
+
module PersonName
|
8
|
+
|
9
|
+
|
10
|
+
# Return true iff the person has a first name and its non-blank
|
11
|
+
|
12
|
+
def first_name?
|
13
|
+
respond_to?(:first_name) and first_name and first_name!='' and first_name.strip!=''
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
# Return true iff the person has a middle name and its non-blank
|
18
|
+
|
19
|
+
def middle_name?
|
20
|
+
respond_to?(:middle_name) and middle_name and middle_name!='' and middle_name.strip!=''
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
# Return true iff the person has a last name and its non-blank
|
25
|
+
|
26
|
+
def last_name?
|
27
|
+
respond_to?(:last_name) and last_name and last_name!='' and last_name.strip!=''
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
# Return the person's first name + middle name
|
32
|
+
#
|
33
|
+
# ==Example
|
34
|
+
# u.first_name_middle_name => "Martin Luther"
|
35
|
+
|
36
|
+
def first_name_middle_name
|
37
|
+
pieces = []
|
38
|
+
(pieces << first_name) if first_name?
|
39
|
+
(pieces << middle_name) if middle_name?
|
40
|
+
return pieces.join(' ')
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
# Return the person's first name + middle initial
|
45
|
+
#
|
46
|
+
# ==Example
|
47
|
+
# u.first_name_middle_initial => "Martin N"
|
48
|
+
|
49
|
+
def first_name_middle_initial
|
50
|
+
pieces = []
|
51
|
+
(pieces << first_name) if first_name?
|
52
|
+
(pieces << middle_name[0...1]) if middle_name?
|
53
|
+
return pieces.join(' ')
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
# Return the person's first name + middle initial + last name
|
58
|
+
#
|
59
|
+
# ==Example
|
60
|
+
# u.first_name_middle_initial_last_name => "Martin N King"
|
61
|
+
|
62
|
+
def first_name_middle_initial_last_name
|
63
|
+
pieces = []
|
64
|
+
(pieces << first_name) if first_name?
|
65
|
+
(pieces << middle_name[0...1]) if middle_name?
|
66
|
+
(pieces << last_name) if last_name?
|
67
|
+
return pieces.join(' ')
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
# Return the person's full name: first_name middle_name last_name
|
72
|
+
#
|
73
|
+
# ==Example
|
74
|
+
# u.full_name => "Martin Luther King"
|
75
|
+
#
|
76
|
+
# This method skips any piece of the name that is missing or blank.
|
77
|
+
|
78
|
+
def full_name
|
79
|
+
pieces = []
|
80
|
+
(pieces << first_name) if first_name?
|
81
|
+
(pieces << middle_name) if middle_name?
|
82
|
+
(pieces << last_name) if last_name?
|
83
|
+
return pieces.join(' ')
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
# Return the person's list name: last_name, first_name middle_name
|
88
|
+
#
|
89
|
+
# ==Example
|
90
|
+
# u.list_name => "King, Martin Luther"
|
91
|
+
#
|
92
|
+
# This method skips any piece of the name that is missing or blank.
|
93
|
+
|
94
|
+
def list_name
|
95
|
+
pieces = []
|
96
|
+
(pieces << first_name) if first_name?
|
97
|
+
(pieces << middle_name) if middle_name?
|
98
|
+
if last_name?
|
99
|
+
comma = pieces.size>0 ? ',' : ''
|
100
|
+
pieces.unshift(last_name+comma)
|
101
|
+
end
|
102
|
+
return pieces.join(' ')
|
103
|
+
end
|
104
|
+
|
105
|
+
|
106
|
+
# Return the person's intials
|
107
|
+
#
|
108
|
+
# ==Example
|
109
|
+
# u.initials => "MLK"
|
110
|
+
#
|
111
|
+
# This method skips any piece of the name that is missing or blank.
|
112
|
+
|
113
|
+
def initials
|
114
|
+
s = ""
|
115
|
+
(s << first_name[0]) if first_name?
|
116
|
+
(s << middle_name[0]) if middle_name?
|
117
|
+
(s << last_name[0]) if last_name?
|
118
|
+
return s
|
119
|
+
end
|
120
|
+
|
121
|
+
|
122
|
+
end
|
@@ -0,0 +1,227 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "sixarm_ruby_person_name_test"
|
3
|
+
|
4
|
+
describe PersonName do
|
5
|
+
|
6
|
+
include PersonName
|
7
|
+
|
8
|
+
before do
|
9
|
+
F ||= Person.new("abc", nil, nil) # First name
|
10
|
+
M ||= Person.new( nil, "def", nil) # Middle name
|
11
|
+
L ||= Person.new( nil, nil, "ghi") # Last name
|
12
|
+
FM ||= Person.new("abc", "def", nil) # First name & Middle name
|
13
|
+
FL ||= Person.new("abc", nil, "ghi") # First name & Last name
|
14
|
+
ML ||= Person.new( nil, "def", "ghi") # Middle name & Last name
|
15
|
+
FML ||= Person.new("abc", "def", "ghi") # First name & Middle name & Last name
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#first_name_middle_name" do
|
19
|
+
|
20
|
+
it "with first" do
|
21
|
+
F.first_name_middle_name.must_equal("abc")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "with middle" do
|
25
|
+
M.first_name_middle_name.must_equal("def")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "with last" do
|
29
|
+
L.first_name_middle_name.must_equal("")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "with first & middle" do
|
33
|
+
FM.first_name_middle_name.must_equal("abc def")
|
34
|
+
end
|
35
|
+
|
36
|
+
it "with first & last" do
|
37
|
+
FL.first_name_middle_name.must_equal("abc")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "with middle & last" do
|
41
|
+
ML.first_name_middle_name.must_equal("def")
|
42
|
+
end
|
43
|
+
|
44
|
+
it "with first & middle & last" do
|
45
|
+
FML.first_name_middle_name.must_equal("abc def")
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "#first_name_middle_initial" do
|
51
|
+
|
52
|
+
it "with first" do
|
53
|
+
F.first_name_middle_initial.must_equal("abc")
|
54
|
+
end
|
55
|
+
|
56
|
+
it "with middle" do
|
57
|
+
M.first_name_middle_initial.must_equal("d")
|
58
|
+
end
|
59
|
+
|
60
|
+
it "with last" do
|
61
|
+
L.first_name_middle_initial.must_equal("")
|
62
|
+
end
|
63
|
+
|
64
|
+
it "with first & middle" do
|
65
|
+
FM.first_name_middle_initial.must_equal("abc d")
|
66
|
+
end
|
67
|
+
|
68
|
+
it "with first & last" do
|
69
|
+
FL.first_name_middle_initial.must_equal("abc")
|
70
|
+
end
|
71
|
+
|
72
|
+
it "with middle & last" do
|
73
|
+
ML.first_name_middle_initial.must_equal("d")
|
74
|
+
end
|
75
|
+
|
76
|
+
it "with first & middle & last" do
|
77
|
+
FML.first_name_middle_initial.must_equal("abc d")
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "#first_name_middle_initial_last_name" do
|
83
|
+
|
84
|
+
it "with first" do
|
85
|
+
F.first_name_middle_initial_last_name.must_equal("abc")
|
86
|
+
end
|
87
|
+
|
88
|
+
it "with middle" do
|
89
|
+
M.first_name_middle_initial_last_name.must_equal("d")
|
90
|
+
end
|
91
|
+
|
92
|
+
it "with last" do
|
93
|
+
L.first_name_middle_initial_last_name.must_equal("ghi")
|
94
|
+
end
|
95
|
+
|
96
|
+
it "with first &_middle" do
|
97
|
+
FM.first_name_middle_initial_last_name.must_equal("abc d")
|
98
|
+
end
|
99
|
+
|
100
|
+
it "with first &_last" do
|
101
|
+
FL.first_name_middle_initial_last_name.must_equal("abc ghi")
|
102
|
+
end
|
103
|
+
|
104
|
+
it "with middle &_last" do
|
105
|
+
ML.first_name_middle_initial_last_name.must_equal("d ghi")
|
106
|
+
end
|
107
|
+
|
108
|
+
it "with first & middle &_last" do
|
109
|
+
FML.first_name_middle_initial_last_name.must_equal("abc d ghi")
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
describe "#full_name" do
|
115
|
+
|
116
|
+
it "with first" do
|
117
|
+
F.full_name.must_equal("abc")
|
118
|
+
end
|
119
|
+
|
120
|
+
it "with middle" do
|
121
|
+
M.full_name.must_equal("def")
|
122
|
+
end
|
123
|
+
|
124
|
+
it "with last" do
|
125
|
+
L.full_name.must_equal("ghi")
|
126
|
+
end
|
127
|
+
|
128
|
+
it "with first & middle" do
|
129
|
+
FM.full_name.must_equal("abc def")
|
130
|
+
end
|
131
|
+
|
132
|
+
it "with first & last" do
|
133
|
+
FL.full_name.must_equal("abc ghi")
|
134
|
+
end
|
135
|
+
|
136
|
+
it "with middle & last" do
|
137
|
+
ML.full_name.must_equal("def ghi")
|
138
|
+
end
|
139
|
+
|
140
|
+
it "with first & middle & last" do
|
141
|
+
FML.full_name.must_equal("abc def ghi")
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
describe "#list_name" do
|
147
|
+
|
148
|
+
it "with first" do
|
149
|
+
F.list_name.must_equal("abc")
|
150
|
+
end
|
151
|
+
|
152
|
+
it "with middle" do
|
153
|
+
M.list_name.must_equal("def")
|
154
|
+
end
|
155
|
+
|
156
|
+
it "with last" do
|
157
|
+
L.list_name.must_equal("ghi")
|
158
|
+
end
|
159
|
+
|
160
|
+
it "with first & middle" do
|
161
|
+
FM.list_name.must_equal("abc def")
|
162
|
+
end
|
163
|
+
|
164
|
+
it "with first & last" do
|
165
|
+
FL.list_name.must_equal("ghi, abc")
|
166
|
+
end
|
167
|
+
|
168
|
+
it "with middle & last" do
|
169
|
+
ML.list_name.must_equal("ghi, def")
|
170
|
+
end
|
171
|
+
|
172
|
+
it "with first & middle & last" do
|
173
|
+
FML.list_name.must_equal("ghi, abc def")
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
|
178
|
+
describe "#initials" do
|
179
|
+
|
180
|
+
it "with first" do
|
181
|
+
F.initials.must_equal("a")
|
182
|
+
end
|
183
|
+
|
184
|
+
it "with middle" do
|
185
|
+
M.initials.must_equal("d")
|
186
|
+
end
|
187
|
+
|
188
|
+
it "with last" do
|
189
|
+
L.initials.must_equal("g")
|
190
|
+
end
|
191
|
+
|
192
|
+
it "with first & middle" do
|
193
|
+
FM.initials.must_equal("ad")
|
194
|
+
end
|
195
|
+
|
196
|
+
it "with first & last" do
|
197
|
+
FL.initials.must_equal("ag")
|
198
|
+
end
|
199
|
+
|
200
|
+
it "with middle & last" do
|
201
|
+
ML.initials.must_equal("dg")
|
202
|
+
end
|
203
|
+
|
204
|
+
it "with first & middle & last" do
|
205
|
+
FML.initials.must_equal("adg")
|
206
|
+
end
|
207
|
+
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|
211
|
+
|
212
|
+
|
213
|
+
class Person
|
214
|
+
|
215
|
+
attr_accessor :first_name
|
216
|
+
attr_accessor :middle_name
|
217
|
+
attr_accessor :last_name
|
218
|
+
|
219
|
+
include PersonName
|
220
|
+
|
221
|
+
def initialize(first,middle,last)
|
222
|
+
@first_name=first
|
223
|
+
@middle_name=middle
|
224
|
+
@last_name=last
|
225
|
+
end
|
226
|
+
|
227
|
+
end
|
@@ -1,230 +1,11 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require "minitest/autorun"
|
3
|
+
require "coveralls"
|
4
|
+
require "simplecov"
|
5
|
+
Coveralls.wear!
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
7
|
+
SimpleCov::Formatter::HTMLFormatter,
|
8
|
+
Coveralls::SimpleCov::Formatter
|
9
|
+
]
|
4
10
|
SimpleCov.start
|
5
|
-
require
|
6
|
-
|
7
|
-
describe PersonName do
|
8
|
-
|
9
|
-
include PersonName
|
10
|
-
|
11
|
-
before do
|
12
|
-
F ||= Person.new("abc", nil, nil) # First name
|
13
|
-
M ||= Person.new( nil, "def", nil) # Middle name
|
14
|
-
L ||= Person.new( nil, nil, "ghi") # Last name
|
15
|
-
FM ||= Person.new("abc", "def", nil) # First name & Middle name
|
16
|
-
FL ||= Person.new("abc", nil, "ghi") # First name & Last name
|
17
|
-
ML ||= Person.new( nil, "def", "ghi") # Middle name & Last name
|
18
|
-
FML ||= Person.new("abc", "def", "ghi") # First name & Middle name & Last name
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "#first_name_middle_name" do
|
22
|
-
|
23
|
-
it "with first" do
|
24
|
-
F.first_name_middle_name.must_equal("abc")
|
25
|
-
end
|
26
|
-
|
27
|
-
it "with middle" do
|
28
|
-
M.first_name_middle_name.must_equal("def")
|
29
|
-
end
|
30
|
-
|
31
|
-
it "with last" do
|
32
|
-
L.first_name_middle_name.must_equal("")
|
33
|
-
end
|
34
|
-
|
35
|
-
it "with first & middle" do
|
36
|
-
FM.first_name_middle_name.must_equal("abc def")
|
37
|
-
end
|
38
|
-
|
39
|
-
it "with first & last" do
|
40
|
-
FL.first_name_middle_name.must_equal("abc")
|
41
|
-
end
|
42
|
-
|
43
|
-
it "with middle & last" do
|
44
|
-
ML.first_name_middle_name.must_equal("def")
|
45
|
-
end
|
46
|
-
|
47
|
-
it "with first & middle & last" do
|
48
|
-
FML.first_name_middle_name.must_equal("abc def")
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
describe "#first_name_middle_initial" do
|
54
|
-
|
55
|
-
it "with first" do
|
56
|
-
F.first_name_middle_initial.must_equal("abc")
|
57
|
-
end
|
58
|
-
|
59
|
-
it "with middle" do
|
60
|
-
M.first_name_middle_initial.must_equal("d")
|
61
|
-
end
|
62
|
-
|
63
|
-
it "with last" do
|
64
|
-
L.first_name_middle_initial.must_equal("")
|
65
|
-
end
|
66
|
-
|
67
|
-
it "with first & middle" do
|
68
|
-
FM.first_name_middle_initial.must_equal("abc d")
|
69
|
-
end
|
70
|
-
|
71
|
-
it "with first & last" do
|
72
|
-
FL.first_name_middle_initial.must_equal("abc")
|
73
|
-
end
|
74
|
-
|
75
|
-
it "with middle & last" do
|
76
|
-
ML.first_name_middle_initial.must_equal("d")
|
77
|
-
end
|
78
|
-
|
79
|
-
it "with first & middle & last" do
|
80
|
-
FML.first_name_middle_initial.must_equal("abc d")
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|
84
|
-
|
85
|
-
describe "#first_name_middle_initial_last_name" do
|
86
|
-
|
87
|
-
it "with first" do
|
88
|
-
F.first_name_middle_initial_last_name.must_equal("abc")
|
89
|
-
end
|
90
|
-
|
91
|
-
it "with middle" do
|
92
|
-
M.first_name_middle_initial_last_name.must_equal("d")
|
93
|
-
end
|
94
|
-
|
95
|
-
it "with last" do
|
96
|
-
L.first_name_middle_initial_last_name.must_equal("ghi")
|
97
|
-
end
|
98
|
-
|
99
|
-
it "with first &_middle" do
|
100
|
-
FM.first_name_middle_initial_last_name.must_equal("abc d")
|
101
|
-
end
|
102
|
-
|
103
|
-
it "with first &_last" do
|
104
|
-
FL.first_name_middle_initial_last_name.must_equal("abc ghi")
|
105
|
-
end
|
106
|
-
|
107
|
-
it "with middle &_last" do
|
108
|
-
ML.first_name_middle_initial_last_name.must_equal("d ghi")
|
109
|
-
end
|
110
|
-
|
111
|
-
it "with first & middle &_last" do
|
112
|
-
FML.first_name_middle_initial_last_name.must_equal("abc d ghi")
|
113
|
-
end
|
114
|
-
|
115
|
-
end
|
116
|
-
|
117
|
-
describe "#full_name" do
|
118
|
-
|
119
|
-
it "with first" do
|
120
|
-
F.full_name.must_equal("abc")
|
121
|
-
end
|
122
|
-
|
123
|
-
it "with middle" do
|
124
|
-
M.full_name.must_equal("def")
|
125
|
-
end
|
126
|
-
|
127
|
-
it "with last" do
|
128
|
-
L.full_name.must_equal("ghi")
|
129
|
-
end
|
130
|
-
|
131
|
-
it "with first & middle" do
|
132
|
-
FM.full_name.must_equal("abc def")
|
133
|
-
end
|
134
|
-
|
135
|
-
it "with first & last" do
|
136
|
-
FL.full_name.must_equal("abc ghi")
|
137
|
-
end
|
138
|
-
|
139
|
-
it "with middle & last" do
|
140
|
-
ML.full_name.must_equal("def ghi")
|
141
|
-
end
|
142
|
-
|
143
|
-
it "with first & middle & last" do
|
144
|
-
FML.full_name.must_equal("abc def ghi")
|
145
|
-
end
|
146
|
-
|
147
|
-
end
|
148
|
-
|
149
|
-
describe "#list_name" do
|
150
|
-
|
151
|
-
it "with first" do
|
152
|
-
F.list_name.must_equal("abc")
|
153
|
-
end
|
154
|
-
|
155
|
-
it "with middle" do
|
156
|
-
M.list_name.must_equal("def")
|
157
|
-
end
|
158
|
-
|
159
|
-
it "with last" do
|
160
|
-
L.list_name.must_equal("ghi")
|
161
|
-
end
|
162
|
-
|
163
|
-
it "with first & middle" do
|
164
|
-
FM.list_name.must_equal("abc def")
|
165
|
-
end
|
166
|
-
|
167
|
-
it "with first & last" do
|
168
|
-
FL.list_name.must_equal("ghi, abc")
|
169
|
-
end
|
170
|
-
|
171
|
-
it "with middle & last" do
|
172
|
-
ML.list_name.must_equal("ghi, def")
|
173
|
-
end
|
174
|
-
|
175
|
-
it "with first & middle & last" do
|
176
|
-
FML.list_name.must_equal("ghi, abc def")
|
177
|
-
end
|
178
|
-
|
179
|
-
end
|
180
|
-
|
181
|
-
describe "#initials" do
|
182
|
-
|
183
|
-
it "with first" do
|
184
|
-
F.initials.must_equal("a")
|
185
|
-
end
|
186
|
-
|
187
|
-
it "with middle" do
|
188
|
-
M.initials.must_equal("d")
|
189
|
-
end
|
190
|
-
|
191
|
-
it "with last" do
|
192
|
-
L.initials.must_equal("g")
|
193
|
-
end
|
194
|
-
|
195
|
-
it "with first & middle" do
|
196
|
-
FM.initials.must_equal("ad")
|
197
|
-
end
|
198
|
-
|
199
|
-
it "with first & last" do
|
200
|
-
FL.initials.must_equal("ag")
|
201
|
-
end
|
202
|
-
|
203
|
-
it "with middle & last" do
|
204
|
-
ML.initials.must_equal("dg")
|
205
|
-
end
|
206
|
-
|
207
|
-
it "with first & middle & last" do
|
208
|
-
FML.initials.must_equal("adg")
|
209
|
-
end
|
210
|
-
|
211
|
-
end
|
212
|
-
|
213
|
-
end
|
214
|
-
|
215
|
-
|
216
|
-
class Person
|
217
|
-
|
218
|
-
attr_accessor :first_name
|
219
|
-
attr_accessor :middle_name
|
220
|
-
attr_accessor :last_name
|
221
|
-
|
222
|
-
include PersonName
|
223
|
-
|
224
|
-
def initialize(first,middle,last)
|
225
|
-
@first_name=first
|
226
|
-
@middle_name=middle
|
227
|
-
@last_name=last
|
228
|
-
end
|
229
|
-
|
230
|
-
end
|
11
|
+
require "sixarm_ruby_person_name"
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,92 +1,172 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sixarm_ruby_person_name
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- SixArm
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain:
|
12
|
-
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIGCTCCA/GgAwIBAgIJAK3igyLv2hNNMA0GCSqGSIb3DQEBBQUAMGAxCzAJBgNV
|
16
14
|
BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
MjEzMjMyNzEzWhcNMTMwOTA4MjMyNzEzWjBgMQswCQYDVQQGEwJVUzETMBEGA1UE
|
21
|
-
|
15
|
+
c2NvMQ8wDQYDVQQKEwZTaXhBcm0xEzARBgNVBAMTCnNpeGFybS5jb20wHhcNMTUw
|
16
|
+
MzE0MjA0MTE5WhcNMTcxMjA4MjA0MTE5WjBgMQswCQYDVQQGEwJVUzETMBEGA1UE
|
22
17
|
CBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEPMA0GA1UEChMG
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
18
|
+
U2l4QXJtMRMwEQYDVQQDEwpzaXhhcm0uY29tMIICIjANBgkqhkiG9w0BAQEFAAOC
|
19
|
+
Ag8AMIICCgKCAgEA4et7SlePzuE46eK5BAVVGg+yWt6FkX7xcLt3Uun9RntKPSuR
|
20
|
+
TbS/+KBqbja5reZD64hdQ9npxpQPKafxUm+RlCd9F5KFxwi8G9usKzCTPOwUeDI2
|
21
|
+
TNEfC+1eRU19QuEW58ZC0pC/bx5Zmp6/DTD6VV+qxKEE9U1M5P85LNkwnxqmRIMR
|
22
|
+
AN8VKOG+GRGOMNDGZ8Kp4h5V3Wyu0N7anY8AUveIx1SyLrEbAhcWp1asLs+/H22q
|
23
|
+
92YFgnwTtnDpZsAmNgZrVw9xY0v79BXqPoyKIl2psPfZi2mOIWi/N+cx6LGF1G+B
|
24
|
+
b+NZdAgwuLyFOoVknkTqsuYEsFhxz0dqDUgM/RvGrADxZk6yUD/1lBNTWnIDVKaN
|
25
|
+
Onu08gOb1lfn21Sbd5r/K32hngasiEuDvh61pJVwszBuFv3v++hVlvNzHw9oT7wc
|
26
|
+
W0z258Qw6fkPhozF5l+zaR+xPZG/4Kk4vc3D4mnw5MEHna6Q9rVsVktqGuIOie8Q
|
27
|
+
5MQAyjdNxywnl7GDllX97oVN+35JbyTePeUyZZnk5tb4p6BlYrd3rtQ2Te7tkQRz
|
28
|
+
8T4Scy5THaPvxf8SsfDGSj3AVPARvSX//hSFFxJM+up+S1jsquU0RjBU52nCdh7p
|
29
|
+
1hBZ1nqfVPeSktx3F+R2RZBPA692UKjpSA7r2vOEfoh3rUTEsNUBQGpPg2MCAwEA
|
30
|
+
AaOBxTCBwjAdBgNVHQ4EFgQUHnpLsysq561sVXhWi+3NoSb9n94wgZIGA1UdIwSB
|
31
|
+
ijCBh4AUHnpLsysq561sVXhWi+3NoSb9n96hZKRiMGAxCzAJBgNVBAYTAlVTMRMw
|
32
|
+
EQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMQ8wDQYD
|
33
|
+
VQQKEwZTaXhBcm0xEzARBgNVBAMTCnNpeGFybS5jb22CCQCt4oMi79oTTTAMBgNV
|
34
|
+
HRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4ICAQCYcCnvJpEhpo5mdVM8JDUuUZFt
|
35
|
+
qP2Kvj9J6tqugO+cuUF2S/ro4gdEQhl7Gv6+DCWHd0FQWJBSXMsZ9a6RhFGAcE5C
|
36
|
+
egK706Gh40yNeobd1aoUh+Pn17kYH2WSBRC+KsIvhZaAnra/1JPZItoge64GS+lM
|
37
|
+
PJJbVrtSati++s39wnss1QlMy9TXoesmR8vqsOU0XdCnK5hOun5RA8SYDWLffsfG
|
38
|
+
E3hvCg4C5viEkPY0YdC0KMSqs5kIA2nCUiqpkwIOa36rVEwiKiU7OCfE3u3baDpL
|
39
|
+
FlfMBznZKOdxDFAmNaxvXBe2XeTzrZPvJtnNLWL6K4LaBHhq3bBdh1Hge0iMkpQ7
|
40
|
+
RTIGlfhlIFkMV3wT0LTsNznUPsoo6e+IW/tDrk23mrNRY6QynTETb+QVIevuzD9m
|
41
|
+
Drcxp/zlVhud+a0ezdnyNvF520arJWvqA4GrOo8F+TT2vVrjscgYjiVGdSq+8wQv
|
42
|
+
Efa5jhe8QwG7R1rdpMMP5yBSAqWuFBczMveX5j4rp9Ifw5/XsZbgwcmdm26bjhzh
|
43
|
+
w2grAHIhvR9mztm6uXQlZhv1fu3P+RWHDSYhnZSCJSCdxPzQJ1mG5T5ahiL3HvCZ
|
44
|
+
2AC9FOGkybW6DJEFSFFMlNk0IILsa/gNp8ufGuTVLWF9FUUdMNK+TMbghnifT8/1
|
45
|
+
n+ES/gQPOnvmVkLDGw==
|
48
46
|
-----END CERTIFICATE-----
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
47
|
+
date: 2015-07-19 00:00:00.000000000 Z
|
48
|
+
dependencies:
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: minitest
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 5.7.0
|
56
|
+
- - "<"
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '6'
|
59
|
+
type: :development
|
60
|
+
prerelease: false
|
61
|
+
version_requirements: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 5.7.0
|
66
|
+
- - "<"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 10.4.2
|
76
|
+
- - "<"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '11'
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 10.4.2
|
86
|
+
- - "<"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '11'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: simplecov
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.10.0
|
96
|
+
- - "<"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '2'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 0.10.0
|
106
|
+
- - "<"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '2'
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: coveralls
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 0.8.2
|
116
|
+
- - "<"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '2'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.8.2
|
126
|
+
- - "<"
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '2'
|
129
|
+
description: PersonName methods to calculate a person's full name, list name, initials,
|
130
|
+
etc.
|
54
131
|
email: sixarm@sixarm.com
|
55
132
|
executables: []
|
56
133
|
extensions: []
|
57
134
|
extra_rdoc_files: []
|
58
135
|
files:
|
59
|
-
- .gemtest
|
60
136
|
- Rakefile
|
61
|
-
- README.md
|
62
|
-
- VERSION
|
63
137
|
- lib/sixarm_ruby_person_name.rb
|
138
|
+
- lib/sixarm_ruby_person_name/person_name.rb
|
64
139
|
- test/sixarm_ruby_person_name_test.rb
|
140
|
+
- test/sixarm_ruby_person_name_test/person_name_test.rb
|
65
141
|
homepage: http://sixarm.com/
|
66
|
-
licenses:
|
142
|
+
licenses:
|
143
|
+
- BSD
|
144
|
+
- GPL
|
145
|
+
- MIT
|
146
|
+
- PAL
|
147
|
+
- Various
|
148
|
+
metadata: {}
|
67
149
|
post_install_message:
|
68
150
|
rdoc_options: []
|
69
151
|
require_paths:
|
70
152
|
- lib
|
71
153
|
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
73
154
|
requirements:
|
74
|
-
- -
|
155
|
+
- - ">="
|
75
156
|
- !ruby/object:Gem::Version
|
76
157
|
version: '0'
|
77
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
-
none: false
|
79
159
|
requirements:
|
80
|
-
- -
|
160
|
+
- - ">="
|
81
161
|
- !ruby/object:Gem::Version
|
82
162
|
version: '0'
|
83
163
|
requirements: []
|
84
164
|
rubyforge_project:
|
85
|
-
rubygems_version:
|
165
|
+
rubygems_version: 2.4.8
|
86
166
|
signing_key:
|
87
|
-
specification_version:
|
88
|
-
summary: SixArm.com » Ruby » PersonName
|
89
|
-
name, list name, initials, etc.
|
167
|
+
specification_version: 4
|
168
|
+
summary: SixArm.com » Ruby » PersonName methods
|
90
169
|
test_files:
|
91
170
|
- test/sixarm_ruby_person_name_test.rb
|
171
|
+
- test/sixarm_ruby_person_name_test/person_name_test.rb
|
92
172
|
has_rdoc: true
|
metadata.gz.sig
CHANGED
Binary file
|
data/.gemtest
DELETED
File without changes
|
data/README.md
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
# SixArm.com » Ruby » <br> PersonName gem accesses a person's name from ActiveRecord fields
|
2
|
-
|
3
|
-
* Docs: <http://sixarm.com/sixarm_ruby_person_name/doc>
|
4
|
-
* Repo: <http://github.com/sixarm/sixarm_ruby_person_name>
|
5
|
-
* Email: Joel Parker Henderson, <joel@sixarm.com>
|
6
|
-
|
7
|
-
|
8
|
-
## Introduction
|
9
|
-
|
10
|
-
Our user models typically have accessors like these:
|
11
|
-
|
12
|
-
user.first_name => "Martin"
|
13
|
-
user.middle_name => "Luther"
|
14
|
-
user.last_name => "King"
|
15
|
-
|
16
|
-
This gem is a utility to concatenate the user's name various common ways:
|
17
|
-
|
18
|
-
user.full_name => "Martin Luther King"
|
19
|
-
user.list_name => "King, Martin Luther"
|
20
|
-
user.initials => "MLK"
|
21
|
-
|
22
|
-
It's fine if the model doesn't have a middle_name field, or if any of the values of any of the fields are nil or blank; this gem will do the right thing.
|
23
|
-
|
24
|
-
For docs go to <http://sixarm.com/sixarm_ruby_person_name/doc>
|
25
|
-
|
26
|
-
Want to help? We're happy to get pull requests.
|
27
|
-
|
28
|
-
|
29
|
-
## Install quickstart
|
30
|
-
|
31
|
-
Install:
|
32
|
-
|
33
|
-
gem install sixarm_ruby_person_name
|
34
|
-
|
35
|
-
Bundler:
|
36
|
-
|
37
|
-
gem "sixarm_ruby_person_name", "~>1.0.4"
|
38
|
-
|
39
|
-
Require:
|
40
|
-
|
41
|
-
require "sixarm_ruby_person_name"
|
42
|
-
|
43
|
-
|
44
|
-
## Install with security (optional)
|
45
|
-
|
46
|
-
To enable high security for all our gems:
|
47
|
-
|
48
|
-
wget http://sixarm.com/sixarm.pem
|
49
|
-
gem cert --add sixarm.pem
|
50
|
-
gem sources --add http://sixarm.com
|
51
|
-
|
52
|
-
To install with high security:
|
53
|
-
|
54
|
-
gem install sixarm_ruby_person_name --test --trust-policy HighSecurity
|
55
|
-
|
56
|
-
|
57
|
-
## Example
|
58
|
-
|
59
|
-
Create a typical user class, include this mixin, the use it:
|
60
|
-
|
61
|
-
require "sixarm_ruby_person_name"
|
62
|
-
|
63
|
-
class User < ActiveRecord::Base
|
64
|
-
include PersonName
|
65
|
-
end
|
66
|
-
|
67
|
-
user=User.new(
|
68
|
-
first_name => 'Martin',
|
69
|
-
middle_name => 'Luther',
|
70
|
-
last_name => 'King'
|
71
|
-
)
|
72
|
-
|
73
|
-
user.full_name => "Martin Luther King"
|
74
|
-
user.list_name => "King, Martin Luther"
|
75
|
-
user.initials => "MLK"
|
76
|
-
user.first_name_middle_name => "Martin Luther"
|
77
|
-
user.first_name_middle_initial => "Martin L"
|
78
|
-
user.first_name_middle_initial_last_name => "Martin L King"
|
79
|
-
|
80
|
-
|
81
|
-
## Performance Tip
|
82
|
-
|
83
|
-
To make these very fast in Rails, you can use memoize:
|
84
|
-
|
85
|
-
class User < ActiveRecord::Base
|
86
|
-
extend ActiveSupport::Memoizable
|
87
|
-
include PersonName
|
88
|
-
memoize :full_name,
|
89
|
-
:list_name,
|
90
|
-
:initials,
|
91
|
-
:first_name_middle_name,
|
92
|
-
:first_name_middle_initial,
|
93
|
-
:first_name_middle_initial_last_name,
|
94
|
-
:first_name_last_name
|
95
|
-
end
|
96
|
-
|
97
|
-
|
98
|
-
## Changes
|
99
|
-
|
100
|
-
* 2012-03-14 1.0.4 Update docs, tests
|
101
|
-
* 2012-01-24 1.0.4 Add #initals method. Add CHANGELOG.txt file. Update examples.
|
102
|
-
|
103
|
-
## License
|
104
|
-
|
105
|
-
You may choose any of these open source licenses:
|
106
|
-
|
107
|
-
* Apache License
|
108
|
-
* BSD License
|
109
|
-
* CreativeCommons License, Non-commercial Share Alike
|
110
|
-
* GNU General Public License Version 2 (GPL 2)
|
111
|
-
* GNU Lesser General Public License (LGPL)
|
112
|
-
* MIT License
|
113
|
-
* Perl Artistic License
|
114
|
-
* Ruby License
|
115
|
-
|
116
|
-
The software is provided "as is", without warranty of any kind,
|
117
|
-
express or implied, including but not limited to the warranties of
|
118
|
-
merchantability, fitness for a particular purpose and noninfringement.
|
119
|
-
|
120
|
-
In no event shall the authors or copyright holders be liable for any
|
121
|
-
claim, damages or other liability, whether in an action of contract,
|
122
|
-
tort or otherwise, arising from, out of or in connection with the
|
123
|
-
software or the use or other dealings in the software.
|
124
|
-
|
125
|
-
This license is for the included software that is created by SixArm;
|
126
|
-
some of the included software may have its own licenses, copyrights,
|
127
|
-
authors, etc. and these do take precedence over the SixArm license.
|
128
|
-
|
129
|
-
Copyright (c) 2005-2013 Joel Parker Henderson
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.0.4
|