peter-mueller 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +122 -0
- data/Rakefile +16 -0
- data/lib/peter-mueller/address.rb +35 -0
- data/lib/peter-mueller/company.rb +79 -0
- data/lib/peter-mueller/data/freemail_provider.txt +8 -0
- data/lib/peter-mueller/data/mobilvorwahlen.txt +53 -0
- data/lib/peter-mueller/data/nachnamen.txt +1000 -0
- data/lib/peter-mueller/data/orte.txt +1000 -0
- data/lib/peter-mueller/data/strassen.txt +1000 -0
- data/lib/peter-mueller/data/vornamen_frauen.txt +460 -0
- data/lib/peter-mueller/data/vornamen_maenner.txt +540 -0
- data/lib/peter-mueller/data.rb +47 -0
- data/lib/peter-mueller/email.rb +71 -0
- data/lib/peter-mueller/person.rb +75 -0
- data/lib/peter-mueller/phonenumber.rb +76 -0
- data/lib/peter-mueller/version.rb +9 -0
- data/lib/peter-mueller.rb +7 -0
- metadata +96 -0
@@ -0,0 +1,540 @@
|
|
1
|
+
Peter
|
2
|
+
Wolfgang
|
3
|
+
Michael
|
4
|
+
Werner
|
5
|
+
Manfred
|
6
|
+
Thomas
|
7
|
+
Klaus
|
8
|
+
Helmut
|
9
|
+
Josef
|
10
|
+
Heinz
|
11
|
+
Gerhard
|
12
|
+
Jürgen
|
13
|
+
Andreas
|
14
|
+
Hans
|
15
|
+
Günter
|
16
|
+
Dieter
|
17
|
+
Horst
|
18
|
+
Walter
|
19
|
+
Bernd
|
20
|
+
Karl
|
21
|
+
Frank
|
22
|
+
Herbert
|
23
|
+
Franz
|
24
|
+
Martin
|
25
|
+
Christian
|
26
|
+
Stefan
|
27
|
+
Georg
|
28
|
+
Heinrich
|
29
|
+
Karl-Heinz
|
30
|
+
Uwe
|
31
|
+
Rudolf
|
32
|
+
Johann
|
33
|
+
Hermann
|
34
|
+
Kurt
|
35
|
+
Siegfried
|
36
|
+
Rolf
|
37
|
+
Wilhelm
|
38
|
+
Rainer
|
39
|
+
Alfred
|
40
|
+
Joachim
|
41
|
+
Bernhard
|
42
|
+
Norbert
|
43
|
+
Ralf
|
44
|
+
Erich
|
45
|
+
Willi
|
46
|
+
Alexander
|
47
|
+
Jörg
|
48
|
+
Markus
|
49
|
+
Matthias
|
50
|
+
Ulrich
|
51
|
+
Harald
|
52
|
+
Roland
|
53
|
+
Paul
|
54
|
+
Reinhard
|
55
|
+
Günther
|
56
|
+
Ernst
|
57
|
+
Robert
|
58
|
+
Erwin
|
59
|
+
Gerd
|
60
|
+
Lothar
|
61
|
+
Friedrich
|
62
|
+
Fritz
|
63
|
+
Otto
|
64
|
+
Dirk
|
65
|
+
Johannes
|
66
|
+
Wilfried
|
67
|
+
Volker
|
68
|
+
Anton
|
69
|
+
Richard
|
70
|
+
Jens
|
71
|
+
Hubert
|
72
|
+
Hans-Jürgen
|
73
|
+
Ludwig
|
74
|
+
Holger
|
75
|
+
Albert
|
76
|
+
Udo
|
77
|
+
Dietmar
|
78
|
+
Hartmut
|
79
|
+
Reinhold
|
80
|
+
Adolf
|
81
|
+
Christoph
|
82
|
+
Hans-Joachim
|
83
|
+
Detlef
|
84
|
+
Oliver
|
85
|
+
Stephan
|
86
|
+
Daniel
|
87
|
+
Alois
|
88
|
+
Reiner
|
89
|
+
Sven
|
90
|
+
Axel
|
91
|
+
Eberhard
|
92
|
+
Waldemar
|
93
|
+
Heiko
|
94
|
+
Konrad
|
95
|
+
Bruno
|
96
|
+
Steffen
|
97
|
+
Mario
|
98
|
+
Torsten
|
99
|
+
Alfons
|
100
|
+
Sebastian
|
101
|
+
Thorsten
|
102
|
+
Jochen
|
103
|
+
Olaf
|
104
|
+
Friedhelm
|
105
|
+
Rüdiger
|
106
|
+
Ingo
|
107
|
+
Max
|
108
|
+
Hans-Peter
|
109
|
+
Armin
|
110
|
+
Winfried
|
111
|
+
Ewald
|
112
|
+
Jan
|
113
|
+
Rudi
|
114
|
+
Erhard
|
115
|
+
Lutz
|
116
|
+
Carsten
|
117
|
+
Viktor
|
118
|
+
Egon
|
119
|
+
Marco
|
120
|
+
Jakob
|
121
|
+
Tobias
|
122
|
+
Eugen
|
123
|
+
Karlheinz
|
124
|
+
Harry
|
125
|
+
Eduard
|
126
|
+
Andre
|
127
|
+
Klaus-Dieter
|
128
|
+
Achim
|
129
|
+
Hans-Dieter
|
130
|
+
Karsten
|
131
|
+
Claus
|
132
|
+
Theo
|
133
|
+
Florian
|
134
|
+
Mathias
|
135
|
+
Sascha
|
136
|
+
Patrick
|
137
|
+
Gottfried
|
138
|
+
Guido
|
139
|
+
Arno
|
140
|
+
Marcus
|
141
|
+
Eckhard
|
142
|
+
Berthold
|
143
|
+
Emil
|
144
|
+
Marc
|
145
|
+
Franz-Josef
|
146
|
+
Theodor
|
147
|
+
Dietrich
|
148
|
+
Kai
|
149
|
+
Arnold
|
150
|
+
Rene
|
151
|
+
Lars
|
152
|
+
Burkhard
|
153
|
+
Gustav
|
154
|
+
Artur
|
155
|
+
Edmund
|
156
|
+
August
|
157
|
+
Ferdinand
|
158
|
+
Gerald
|
159
|
+
Marcel
|
160
|
+
Philipp
|
161
|
+
Hans-Georg
|
162
|
+
David
|
163
|
+
Fred
|
164
|
+
Leo
|
165
|
+
Willy
|
166
|
+
Ralph
|
167
|
+
Bodo
|
168
|
+
Hugo
|
169
|
+
Maik
|
170
|
+
Björn
|
171
|
+
Klaus-Peter
|
172
|
+
Mike
|
173
|
+
Oskar
|
174
|
+
Ronald
|
175
|
+
Gert
|
176
|
+
Dennis
|
177
|
+
Benjamin
|
178
|
+
Hans-Werner
|
179
|
+
Roman
|
180
|
+
Manuel
|
181
|
+
Wolfram
|
182
|
+
Felix
|
183
|
+
Arthur
|
184
|
+
Gregor
|
185
|
+
Gunter
|
186
|
+
Henning
|
187
|
+
Elmar
|
188
|
+
Nikolaus
|
189
|
+
Heribert
|
190
|
+
Edwin
|
191
|
+
Leonhard
|
192
|
+
Timo
|
193
|
+
Albrecht
|
194
|
+
Raimund
|
195
|
+
Clemens
|
196
|
+
Ludger
|
197
|
+
Simon
|
198
|
+
Adam
|
199
|
+
Heiner
|
200
|
+
Lorenz
|
201
|
+
Henry
|
202
|
+
Friedel
|
203
|
+
Ulf
|
204
|
+
Mehmet
|
205
|
+
Ali
|
206
|
+
Oswald
|
207
|
+
Tim
|
208
|
+
Detlev
|
209
|
+
Antonio
|
210
|
+
Xaver
|
211
|
+
Ronny
|
212
|
+
Engelbert
|
213
|
+
Benno
|
214
|
+
Dominik
|
215
|
+
Mark
|
216
|
+
Gerold
|
217
|
+
André
|
218
|
+
Volkmar
|
219
|
+
Christof
|
220
|
+
Sergej
|
221
|
+
Jörn
|
222
|
+
Karl Heinz
|
223
|
+
Toni
|
224
|
+
Mustafa
|
225
|
+
Helmuth
|
226
|
+
Mirko
|
227
|
+
Marko
|
228
|
+
Gernot
|
229
|
+
Nils
|
230
|
+
Maximilian
|
231
|
+
Ottmar
|
232
|
+
Willibald
|
233
|
+
Boris
|
234
|
+
Hubertus
|
235
|
+
Hans-Jörg
|
236
|
+
Vladimir
|
237
|
+
Enrico
|
238
|
+
Knut
|
239
|
+
Otmar
|
240
|
+
Heino
|
241
|
+
Heinz-Dieter
|
242
|
+
Christopher
|
243
|
+
Alwin
|
244
|
+
Klemens
|
245
|
+
René
|
246
|
+
Giuseppe
|
247
|
+
Fabian
|
248
|
+
Hans-Josef
|
249
|
+
Hans-Ulrich
|
250
|
+
Hartwig
|
251
|
+
Hendrik
|
252
|
+
Kay
|
253
|
+
Hans-Günter
|
254
|
+
Heinz-Jürgen
|
255
|
+
Hilmar
|
256
|
+
Siegmund
|
257
|
+
Nico
|
258
|
+
Hans-Hermann
|
259
|
+
Hermann-Josef
|
260
|
+
Erik
|
261
|
+
Siegbert
|
262
|
+
Rupert
|
263
|
+
Roger
|
264
|
+
Gunther
|
265
|
+
Valentin
|
266
|
+
Helge
|
267
|
+
Julius
|
268
|
+
Hans-Heinrich
|
269
|
+
Ahmet
|
270
|
+
Arne
|
271
|
+
Tino
|
272
|
+
Adalbert
|
273
|
+
Andrej
|
274
|
+
Falk
|
275
|
+
Ingolf
|
276
|
+
Wladimir
|
277
|
+
Ivan
|
278
|
+
Gunnar
|
279
|
+
Hasan
|
280
|
+
Alex
|
281
|
+
Eric
|
282
|
+
Salvatore
|
283
|
+
Thilo
|
284
|
+
Konstantin
|
285
|
+
Hinrich
|
286
|
+
Egbert
|
287
|
+
Joseph
|
288
|
+
Ekkehard
|
289
|
+
Hans Jürgen
|
290
|
+
Benedikt
|
291
|
+
Siegmar
|
292
|
+
Hans Joachim
|
293
|
+
Hans Peter
|
294
|
+
Kevin
|
295
|
+
Ibrahim
|
296
|
+
Silvio
|
297
|
+
Hansjörg
|
298
|
+
Hagen
|
299
|
+
Francesco
|
300
|
+
Adrian
|
301
|
+
Karl-Josef
|
302
|
+
Heinz-Peter
|
303
|
+
Gisbert
|
304
|
+
Wolf
|
305
|
+
Klaus-Jürgen
|
306
|
+
Bastian
|
307
|
+
Nikolai
|
308
|
+
Pascal
|
309
|
+
Giovanni
|
310
|
+
Leopold
|
311
|
+
Bert
|
312
|
+
Denis
|
313
|
+
John
|
314
|
+
Aloys
|
315
|
+
Gebhard
|
316
|
+
Tilo
|
317
|
+
Eckart
|
318
|
+
Reimund
|
319
|
+
Julian
|
320
|
+
Ullrich
|
321
|
+
Igor
|
322
|
+
Murat
|
323
|
+
Wolf-Dieter
|
324
|
+
Gotthard
|
325
|
+
Hans-Gerd
|
326
|
+
Juri
|
327
|
+
Friedrich-Wilhelm
|
328
|
+
Marius
|
329
|
+
Hannes
|
330
|
+
Georgios
|
331
|
+
Roberto
|
332
|
+
Marek
|
333
|
+
Ismail
|
334
|
+
Heinz-Josef
|
335
|
+
Norman
|
336
|
+
Antonius
|
337
|
+
Henrik
|
338
|
+
Horst-Dieter
|
339
|
+
Karl-Friedrich
|
340
|
+
Lukas
|
341
|
+
Hans-Otto
|
342
|
+
Wendelin
|
343
|
+
Albin
|
344
|
+
Klaus Dieter
|
345
|
+
Bertram
|
346
|
+
Arnd
|
347
|
+
Gerrit
|
348
|
+
Arndt
|
349
|
+
Carl
|
350
|
+
Vincenzo
|
351
|
+
Hans-Günther
|
352
|
+
Tom
|
353
|
+
Victor
|
354
|
+
Angelo
|
355
|
+
Sönke
|
356
|
+
Ansgar
|
357
|
+
Malte
|
358
|
+
Rolf-Dieter
|
359
|
+
Franz Josef
|
360
|
+
Sören
|
361
|
+
Moritz
|
362
|
+
Mohamed
|
363
|
+
Rico
|
364
|
+
Götz
|
365
|
+
Frieder
|
366
|
+
Guenter
|
367
|
+
Reinhardt
|
368
|
+
Dimitrios
|
369
|
+
Fridolin
|
370
|
+
Bernard
|
371
|
+
Harri
|
372
|
+
Rafael
|
373
|
+
Hans Dieter
|
374
|
+
Oleg
|
375
|
+
Falko
|
376
|
+
Pierre
|
377
|
+
Friedbert
|
378
|
+
Steven
|
379
|
+
Eckard
|
380
|
+
Kai-Uwe
|
381
|
+
Heinz-Werner
|
382
|
+
Philip
|
383
|
+
Andy
|
384
|
+
Hans-Martin
|
385
|
+
Jonas
|
386
|
+
Osman
|
387
|
+
Hellmut
|
388
|
+
Hans-Walter
|
389
|
+
Heinz-Günter
|
390
|
+
Anatoli
|
391
|
+
Robin
|
392
|
+
Danny
|
393
|
+
Ortwin
|
394
|
+
Hardy
|
395
|
+
Niels
|
396
|
+
Michel
|
397
|
+
Hans-Wilhelm
|
398
|
+
Vitali
|
399
|
+
Juergen
|
400
|
+
Klaus Peter
|
401
|
+
Kuno
|
402
|
+
Burghard
|
403
|
+
Luigi
|
404
|
+
Raphael
|
405
|
+
Chris
|
406
|
+
Torben
|
407
|
+
Hauke
|
408
|
+
Herwig
|
409
|
+
Gabriel
|
410
|
+
Meinolf
|
411
|
+
Enno
|
412
|
+
Milan
|
413
|
+
Hanno
|
414
|
+
Henryk
|
415
|
+
Fredi
|
416
|
+
Kaspar
|
417
|
+
Meinhard
|
418
|
+
Edward
|
419
|
+
Emanuel
|
420
|
+
Dierk
|
421
|
+
Hans Georg
|
422
|
+
Jose
|
423
|
+
Carlo
|
424
|
+
Yusuf
|
425
|
+
Friedemann
|
426
|
+
Konstantinos
|
427
|
+
Hanspeter
|
428
|
+
Nicolas
|
429
|
+
Cornelius
|
430
|
+
Leonid
|
431
|
+
Hans Werner
|
432
|
+
Diethard
|
433
|
+
Domenico
|
434
|
+
Vinzenz
|
435
|
+
Eckehard
|
436
|
+
Sandro
|
437
|
+
Ramazan
|
438
|
+
Claus-Dieter
|
439
|
+
Gero
|
440
|
+
Dimitri
|
441
|
+
Sigurd
|
442
|
+
Till
|
443
|
+
Andree
|
444
|
+
Karl-Wilhelm
|
445
|
+
Christos
|
446
|
+
Metin
|
447
|
+
Berndt
|
448
|
+
Diethelm
|
449
|
+
Jens-Uwe
|
450
|
+
Heinz-Georg
|
451
|
+
Nikolaj
|
452
|
+
Dominic
|
453
|
+
Harro
|
454
|
+
Ernst-August
|
455
|
+
Wulf
|
456
|
+
Veit
|
457
|
+
Ivo
|
458
|
+
Gilbert
|
459
|
+
Franco
|
460
|
+
Gottlieb
|
461
|
+
Ahmed
|
462
|
+
Karl-Ernst
|
463
|
+
Karl-Ludwig
|
464
|
+
Karl-Otto
|
465
|
+
Andrzej
|
466
|
+
Joerg
|
467
|
+
Karl-Heinrich
|
468
|
+
Eckhardt
|
469
|
+
Kemal
|
470
|
+
Jost
|
471
|
+
Carlos
|
472
|
+
Ehrenfried
|
473
|
+
Stanislaw
|
474
|
+
Hans-Christian
|
475
|
+
Josip
|
476
|
+
Ignaz
|
477
|
+
Sigmund
|
478
|
+
Samuel
|
479
|
+
Mirco
|
480
|
+
Heini
|
481
|
+
Steve
|
482
|
+
Claus-Peter
|
483
|
+
Halil
|
484
|
+
Wieland
|
485
|
+
Ömer
|
486
|
+
Magnus
|
487
|
+
Helmar
|
488
|
+
Walther
|
489
|
+
Nikolaos
|
490
|
+
Hans-Jochen
|
491
|
+
Mohammad
|
492
|
+
Janusz
|
493
|
+
Hassan
|
494
|
+
Bertold
|
495
|
+
Helfried
|
496
|
+
Hans-Willi
|
497
|
+
Arnulf
|
498
|
+
Guiseppe
|
499
|
+
Piotr
|
500
|
+
Karl-Hermann
|
501
|
+
Pietro
|
502
|
+
Patrik
|
503
|
+
Orhan
|
504
|
+
Abdullah
|
505
|
+
Ioannis
|
506
|
+
Jean
|
507
|
+
Hellmuth
|
508
|
+
Mohammed
|
509
|
+
Claudio
|
510
|
+
Hanns
|
511
|
+
Otfried
|
512
|
+
Miroslaw
|
513
|
+
Henri
|
514
|
+
William
|
515
|
+
Meinrad
|
516
|
+
Heinz-Joachim
|
517
|
+
Lambert
|
518
|
+
Jonny
|
519
|
+
Bogdan
|
520
|
+
Bernward
|
521
|
+
Darius
|
522
|
+
Yilmaz
|
523
|
+
Cord
|
524
|
+
Roy
|
525
|
+
Wenzel
|
526
|
+
Hakan
|
527
|
+
Herrmann
|
528
|
+
Matthäus
|
529
|
+
Meik
|
530
|
+
Peer
|
531
|
+
Kilian
|
532
|
+
Diedrich
|
533
|
+
Ulli
|
534
|
+
Jacek
|
535
|
+
Heinz-Hermann
|
536
|
+
Jerzy
|
537
|
+
Gerhardt
|
538
|
+
Conrad
|
539
|
+
James
|
540
|
+
Rocco
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module PeterMueller
|
2
|
+
|
3
|
+
# An array male firstnames.
|
4
|
+
FIRSTNAMES_MALE = []
|
5
|
+
|
6
|
+
# An array of female firstnames.
|
7
|
+
FIRSTNAMES_FEMALE = []
|
8
|
+
|
9
|
+
# An array of lastnames.
|
10
|
+
LASTNAMES = []
|
11
|
+
|
12
|
+
# An array of streetnames.
|
13
|
+
STREETS = []
|
14
|
+
|
15
|
+
# An array of towns. The string is composed of 3 strings seperated by tabs (\\t):
|
16
|
+
# zip, phone_prefix, name of the town.
|
17
|
+
TOWNS = []
|
18
|
+
|
19
|
+
# An array of prefixes for mobile phone numbers.
|
20
|
+
MOBILE_PREFIXES = []
|
21
|
+
|
22
|
+
# An array of domains of freemail provider.
|
23
|
+
FREEMAIL_PROVIDER = []
|
24
|
+
|
25
|
+
# An array of TLDs.
|
26
|
+
TLD = ["de", "com", "net", "org", "biz", "info", "name"]
|
27
|
+
|
28
|
+
# An array of abbreviations of form organisations.
|
29
|
+
FORM_OF_ORGANISATION = ['AG', 'GmbH', 'oHG', 'KG', 'GbR']
|
30
|
+
|
31
|
+
private
|
32
|
+
def self.loaddata(konst, filename)
|
33
|
+
fullpath = File.join(File.dirname(__FILE__), "data", filename)
|
34
|
+
File.open(fullpath, "r").each_line do |s|
|
35
|
+
konst << s.strip unless s.strip =~ /\A\s*\z/
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Ladies first:
|
40
|
+
loaddata(FIRSTNAMES_FEMALE, 'vornamen_frauen.txt')
|
41
|
+
loaddata(FIRSTNAMES_MALE, 'vornamen_maenner.txt')
|
42
|
+
loaddata(LASTNAMES, 'nachnamen.txt')
|
43
|
+
loaddata(STREETS, 'strassen.txt')
|
44
|
+
loaddata(TOWNS, 'orte.txt')
|
45
|
+
loaddata(MOBILE_PREFIXES, 'mobilvorwahlen.txt')
|
46
|
+
loaddata(FREEMAIL_PROVIDER, 'freemail_provider.txt')
|
47
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module PeterMueller
|
3
|
+
|
4
|
+
# Creates fictitious email address.
|
5
|
+
class Email
|
6
|
+
# User-part of the address.
|
7
|
+
attr_accessor :user
|
8
|
+
# Host-part of the address.
|
9
|
+
attr_accessor :host
|
10
|
+
|
11
|
+
# Creates a new email address.
|
12
|
+
def initialize(person = Person.new, owndomain = (rand(1..50) == 2))
|
13
|
+
if owndomain
|
14
|
+
@user = [
|
15
|
+
user_from_names(person),
|
16
|
+
user_from_firstname(person, ""),
|
17
|
+
user_from_initials(person, ""),
|
18
|
+
].sample
|
19
|
+
|
20
|
+
@host = [
|
21
|
+
user_from_names(person),
|
22
|
+
TLD.sample,
|
23
|
+
].join(".")
|
24
|
+
else
|
25
|
+
@user = [
|
26
|
+
user_from_names(person),
|
27
|
+
user_from_firstname(person),
|
28
|
+
user_from_initials(person),
|
29
|
+
].sample
|
30
|
+
|
31
|
+
@host = FREEMAIL_PROVIDER.sample
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Returns the string representation of the email address.
|
36
|
+
def to_s
|
37
|
+
"#{@user}@#{@host}"
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.umlautfix(str) #:nodoc:
|
41
|
+
str.
|
42
|
+
gsub("ä","ae").
|
43
|
+
gsub("ö","oe").
|
44
|
+
gsub("ü","ue").
|
45
|
+
gsub("Ä","Ae").
|
46
|
+
gsub("Ö","Oe").
|
47
|
+
gsub("Ü","Ue").
|
48
|
+
gsub("ß","ss")
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
def user_from_names(person, sepchar=["","_","."].sample)
|
53
|
+
part1 = self.class.umlautfix(person.firstname).gsub(/[^a-zA-Z]/,"").downcase
|
54
|
+
part2 = self.class.umlautfix(person.lastname).gsub(/[^a-zA-Z]/,"").downcase
|
55
|
+
"#{part1}#{sepchar}#{part2}"
|
56
|
+
end
|
57
|
+
|
58
|
+
def user_from_firstname(person, number = rand(1..9999).to_s)
|
59
|
+
part = self.class.umlautfix(person.firstname).gsub(/[^a-zA-Z]/,"").downcase
|
60
|
+
"#{part}#{number}"
|
61
|
+
end
|
62
|
+
|
63
|
+
def user_from_initials(person, number = rand(1..9999).to_s)
|
64
|
+
part1 = self.class.umlautfix(person.firstname).gsub(/[^a-zA-Z]/,"").downcase
|
65
|
+
part2 = self.class.umlautfix(person.lastname).gsub(/[^a-zA-Z]/,"").downcase
|
66
|
+
"#{part1[0]}#{part2[0]}#{number}"
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module PeterMueller
|
3
|
+
|
4
|
+
# A fictitious person.
|
5
|
+
class Person
|
6
|
+
|
7
|
+
attr_reader :sex #:nodoc:
|
8
|
+
# The firstname.
|
9
|
+
attr_reader :firstname
|
10
|
+
# The lastname.
|
11
|
+
attr_reader :lastname
|
12
|
+
# The Address.
|
13
|
+
attr_reader :address
|
14
|
+
# The landline Phonenumber. Not every person has a landline Phonenumber.
|
15
|
+
attr_reader :phonenumber
|
16
|
+
# The mobile Phonenumber. Not every person has a mobile Phonenumber.
|
17
|
+
attr_reader :mobile
|
18
|
+
# The mobile Email. Not every person has a Email.
|
19
|
+
attr_reader :email
|
20
|
+
# The office Phonenumber, only set, when the person is an employee of a Company.
|
21
|
+
attr_accessor :office_phonenumber
|
22
|
+
# The office Email, only set, when the person is an employee of a Company.
|
23
|
+
attr_accessor :office_email
|
24
|
+
|
25
|
+
# Creates a new person.
|
26
|
+
def initialize
|
27
|
+
@sex = ['f','m'].sample
|
28
|
+
|
29
|
+
if @sex == 'm'
|
30
|
+
@firstname = FIRSTNAMES_MALE.sample
|
31
|
+
else
|
32
|
+
@firstname = FIRSTNAMES_FEMALE.sample
|
33
|
+
end
|
34
|
+
|
35
|
+
@lastname = LASTNAMES.sample
|
36
|
+
|
37
|
+
@address = Address.new
|
38
|
+
|
39
|
+
@phonenumber = Phonenumber.new(@address.phone_prefix) if rand(1..100) > 10
|
40
|
+
@mobile = Phonenumber.mobile if rand(1..100) > 20
|
41
|
+
|
42
|
+
@email = Email.new(self) if rand(1..100) > 35
|
43
|
+
end
|
44
|
+
|
45
|
+
# Whether the person is male.
|
46
|
+
def male?
|
47
|
+
@sex == 'm'
|
48
|
+
end
|
49
|
+
|
50
|
+
# Whether the person is female.
|
51
|
+
def female?
|
52
|
+
@sex == 'f'
|
53
|
+
end
|
54
|
+
|
55
|
+
# The string representation of the person.
|
56
|
+
def to_s
|
57
|
+
fields = []
|
58
|
+
fields << "#{firstname} #{lastname}"
|
59
|
+
fields << ""
|
60
|
+
fields << address.to_s
|
61
|
+
fields << ""
|
62
|
+
fields << "Telefon: #{phonenumber}" if phonenumber
|
63
|
+
fields << "Mobil: #{@mobile}" if mobile
|
64
|
+
fields << "E-Mail: #{email}" if email
|
65
|
+
if office_email or office_phonenumber
|
66
|
+
fields << "\nGeschäftlich"
|
67
|
+
fields << "Telefon: #{office_phonenumber}" if office_phonenumber
|
68
|
+
fields << "E-Mail: #{office_email}" if office_email
|
69
|
+
end
|
70
|
+
fields.join("\n")
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|