fake_person 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fa40be947d2994e79ba987f7385a3c4e9dc014fb
4
+ data.tar.gz: d8800a50d9c5adbb22a386f40eba23c88e38d2b6
5
+ SHA512:
6
+ metadata.gz: ee863685835d3c5f3b4864a73affaa3bb426f8411489578bd28438f134703292a168114dc8e182be9d939495b21bd089857210d7298319a0d3330d140588f920
7
+ data.tar.gz: b322ae0440a2fc65f61849c0c94a4168fc9d7b8f592fe5b4c64a76ccb753e10a758d2ef89c51ad0dfa731d1f9b7309068d7bbbf842eea1d859968a33c3073f2b
@@ -0,0 +1,81 @@
1
+ abby
2
+ abi
3
+ abigail
4
+ alex
5
+ alexandra
6
+ alexis
7
+ alice
8
+ alison
9
+ amy
10
+ andrea
11
+ anna
12
+ annabelle
13
+ anne
14
+ arabella
15
+ ariana
16
+ ava
17
+ bella
18
+ brooke
19
+ calire
20
+ caroline
21
+ catherine
22
+ charlotte
23
+ chloe
24
+ clara
25
+ edith
26
+ elearnor
27
+ elise
28
+ elizabeth
29
+ elizabeth
30
+ ella
31
+ emily
32
+ emma
33
+ felicity
34
+ florence
35
+ grace
36
+ hailey
37
+ hallie
38
+ harriet
39
+ heidi
40
+ holly
41
+ imogen
42
+ isabella
43
+ josie
44
+ julia
45
+ kaylee
46
+ lara
47
+ leah
48
+ lily
49
+ lottie
50
+ lou
51
+ louisa
52
+ louise
53
+ lucy
54
+ mel
55
+ melanie
56
+ melissa
57
+ mia
58
+ millie
59
+ molly
60
+ mya
61
+ natalie
62
+ nicole
63
+ nina
64
+ olivia
65
+ paige
66
+ phoebe
67
+ pixie
68
+ rachel
69
+ rose
70
+ sara
71
+ sarah
72
+ sophia
73
+ stefanie
74
+ steph
75
+ stephanie
76
+ vanessa
77
+ vicky
78
+ victoria
79
+ violey
80
+ zoe
81
+ zoey
@@ -0,0 +1,72 @@
1
+ aaron
2
+ adam
3
+ adrian
4
+ aidan
5
+ aiden
6
+ alex
7
+ alexander
8
+ alfie
9
+ alfred
10
+ archibald
11
+ ben
12
+ benjamin
13
+ brandon
14
+ brian
15
+ charles
16
+ charlie
17
+ chris
18
+ christian
19
+ christopher
20
+ dan
21
+ daniel
22
+ dave
23
+ david
24
+ dom
25
+ dominic
26
+ ed
27
+ edward
28
+ ethan
29
+ gavin
30
+ harry
31
+ jack
32
+ jacob
33
+ jake
34
+ james
35
+ joe
36
+ john
37
+ jon
38
+ jonathan
39
+ joseph
40
+ josh
41
+ joshua
42
+ julian
43
+ justin
44
+ kev
45
+ kevin
46
+ liam
47
+ luke
48
+ martin
49
+ matthew
50
+ michael
51
+ mike
52
+ nathan
53
+ nicholas
54
+ nick
55
+ noah
56
+ oliver
57
+ olly
58
+ owen
59
+ preston
60
+ rich
61
+ richard
62
+ ryan
63
+ sam
64
+ samuel
65
+ stephen
66
+ steve
67
+ steven
68
+ thomas
69
+ tom
70
+ william
71
+ zach
72
+ zachary
data/db/surnames.txt ADDED
@@ -0,0 +1,106 @@
1
+ adams
2
+ allen
3
+ anderson
4
+ andrews
5
+ bailey
6
+ baker
7
+ bell
8
+ bennett
9
+ brown
10
+ butler
11
+ campbell
12
+ carter
13
+ chapman
14
+ clark
15
+ clarke
16
+ cole
17
+ collins
18
+ cooke
19
+ cooper
20
+ cox
21
+ davies
22
+ davis
23
+ dean
24
+ edwards
25
+ ellis
26
+ evans
27
+ foster
28
+ fox
29
+ graphan
30
+ gray
31
+ green
32
+ griffiths
33
+ hall
34
+ harris
35
+ harrison
36
+ harvey
37
+ hill
38
+ holmes
39
+ hudon
40
+ hughes
41
+ hunt
42
+ hunter
43
+ jackson
44
+ james
45
+ johnson
46
+ jones
47
+ kelly
48
+ kennedy
49
+ king
50
+ knight
51
+ lee
52
+ lewis
53
+ lloyd
54
+ marshall
55
+ martin
56
+ mason
57
+ matthews
58
+ miller
59
+ mitchell
60
+ moore
61
+ morgan
62
+ morris
63
+ murphy
64
+ murray
65
+ owen
66
+ palmer
67
+ parker
68
+ pearce
69
+ phillips
70
+ poole
71
+ powell
72
+ price
73
+ reid
74
+ reynolds
75
+ richards
76
+ richardson
77
+ roberts
78
+ robertson
79
+ robinson
80
+ rogers
81
+ rose
82
+ ross
83
+ russel
84
+ saunders
85
+ scott
86
+ shaw
87
+ simpson
88
+ smith
89
+ stevens
90
+ stewart
91
+ talyor
92
+ thomas
93
+ thompson
94
+ thomson
95
+ turner
96
+ walker
97
+ walsh
98
+ ward
99
+ watson
100
+ white
101
+ wilkinson
102
+ williams
103
+ wilson
104
+ wood
105
+ wright
106
+ young
@@ -0,0 +1,23 @@
1
+ require 'date'
2
+
3
+ class FakePerson
4
+
5
+ #
6
+ # Return the person's date of birth
7
+ #
8
+ def date_of_birth(min_age = 18, max_age = 80)
9
+ @date_of_birth ||= Date.new(Date.today.year - max_age + rand(max_age - min_age), rand(12) + 1, rand(28) + 1)
10
+ end
11
+
12
+ #
13
+ # Return this person's age
14
+ #
15
+ def age
16
+ @age ||= begin
17
+ years = Date.today.year - self.date_of_birth.year
18
+ years -= 1 if Date.today.yday < self.date_of_birth.yday
19
+ years
20
+ end
21
+ end
22
+
23
+ end
@@ -0,0 +1,29 @@
1
+ class FakePerson
2
+
3
+ #
4
+ # Return an email address for this person. All messages sent to example.com
5
+ # will bounce.
6
+ #
7
+ def email_address(domain = 'example.com')
8
+ @email_address ||= "#{username}@#{domain}"
9
+ end
10
+
11
+ #
12
+ # Return a free email address. This might be a real person!
13
+ #
14
+ def free_email_address
15
+ @free_email_address ||= "#{username}@#{self.class.free_email_domains.shuffle.first}"
16
+ end
17
+
18
+ class << self
19
+
20
+ #
21
+ # Return an array of free email hosting domains
22
+ #
23
+ def free_email_domains
24
+ @free_email_domains ||= ["hotmail.com", "gmail.com", "yahoo.com", "gmx.com"]
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,10 @@
1
+ class FakePerson
2
+
3
+ #
4
+ # Return the gender for this person
5
+ #
6
+ def gender
7
+ @gender ||= rand(2) == 0 ? :male : :female
8
+ end
9
+
10
+ end
@@ -0,0 +1,77 @@
1
+ class FakePerson
2
+
3
+ #
4
+ # Return a full name
5
+ #
6
+ def name(format = :standard)
7
+ case format
8
+ when :standard then "#{first_name} #{last_name}"
9
+ when :full then "#{first_name} #{middle_name} #{last_name}"
10
+ when :formal then "#{title}. #{last_name}"
11
+ when :formal_with_first then "#{title}. #{first_name} #{last_name}"
12
+ end
13
+ end
14
+
15
+ #
16
+ # Return the initials
17
+ #
18
+ def initials
19
+ "#{first_name[0,1]}#{middle_name[0,1]}#{last_name[0,1]}"
20
+ end
21
+
22
+ #
23
+ # Return the first name
24
+ #
25
+ def first_name
26
+ @first_name ||= self.class.given_names(self.gender).shuffle.first
27
+ end
28
+
29
+ #
30
+ # Return the middle name
31
+ #
32
+ def middle_name
33
+ @middle_name ||= begin
34
+ while @middle_name.nil? || @middle_name == self.first_name
35
+ @middle_name = self.class.given_names(self.gender).shuffle.first
36
+ end
37
+ @middle_name
38
+ end
39
+ end
40
+
41
+ #
42
+ # Return the last name
43
+ #
44
+ def last_name
45
+ @last_name ||= begin
46
+ while @last_name.nil? || @last_name == self.first_name || @last_name == self.middle_name
47
+ @last_name = self.class.surnames.shuffle.first
48
+ end
49
+ @last_name
50
+ end
51
+ end
52
+
53
+ class << self
54
+
55
+ #
56
+ # Return an array of all possible first names
57
+ #
58
+ def given_names(gender)
59
+ @given_names ||= {}
60
+ @given_names[gender.to_sym] ||= begin
61
+ path = File.expand_path(File.join('..', '..', '..', 'db', "given_names.#{gender}.txt"), __FILE__)
62
+ File.read(path).split("\n").compact.map(&:capitalize)
63
+ end
64
+ end
65
+
66
+ #
67
+ # Return an array of all possible last names
68
+ #
69
+ def surnames
70
+ @surnames ||= begin
71
+ path = File.expand_path(File.join('..', '..', '..', 'db', "surnames.txt"), __FILE__)
72
+ File.read(path).split("\n").compact.map(&:capitalize)
73
+ end
74
+ end
75
+
76
+ end
77
+ end
@@ -0,0 +1,39 @@
1
+ class FakePerson
2
+
3
+ #
4
+ # Return a title
5
+ #
6
+ def title
7
+ @title ||= begin
8
+ base = (gender == :male ? self.class.male_titles : self.class.female_titles)
9
+ base = base | self.class.unisex_titles if rand(5) == 0
10
+ base.shuffle.first
11
+ end
12
+ end
13
+
14
+ class << self
15
+
16
+ #
17
+ # Return all unisex titles
18
+ #
19
+ def unisex_titles
20
+ @unisex_titles ||= ['Dr', 'Prof', 'Rev']
21
+ end
22
+
23
+ #
24
+ # Return all male titles
25
+ #
26
+ def male_titles
27
+ @male_titles ||= ['Mr']
28
+ end
29
+
30
+ #
31
+ # Return all female titles
32
+ #
33
+ def female_titles
34
+ @female_titles ||= ['Mrs', 'Miss', 'Ms']
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,20 @@
1
+ class FakePerson
2
+
3
+ #
4
+ # Return a username which this user can be assigned.
5
+ #
6
+ def username
7
+ @username ||= begin
8
+ case rand(7)
9
+ when 0 then "#{first_name.downcase}.#{last_name.downcase}"
10
+ when 1 then "#{first_name.downcase[0,1]}#{last_name.downcase}"
11
+ when 2 then "#{last_name.downcase}-#{first_name.downcase}"
12
+ when 3 then "#{first_name.downcase}#{last_name.downcase}"
13
+ when 4 then "#{first_name.downcase[0,1]}.#{middle_name.downcase[0,1]}.#{last_name.downcase}"
14
+ when 5 then "#{first_name.downcase}#{date_of_birth.year.to_s[2,2]}"
15
+ when 6 then "#{first_name.downcase}#{last_name.downcase}#{date_of_birth.year}"
16
+ end
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,6 @@
1
+ require 'fake_person/names'
2
+ require 'fake_person/gender'
3
+ require 'fake_person/titles'
4
+ require 'fake_person/username'
5
+ require 'fake_person/date_of_birth'
6
+ require 'fake_person/email'
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fake_person
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Adam Cooke
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-16 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A Ruby library for creating fake personalities
14
+ email:
15
+ - me@adamcooke.io
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - db/given_names.female.txt
21
+ - db/given_names.male.txt
22
+ - db/surnames.txt
23
+ - lib/fake_person.rb
24
+ - lib/fake_person/date_of_birth.rb
25
+ - lib/fake_person/email.rb
26
+ - lib/fake_person/gender.rb
27
+ - lib/fake_person/names.rb
28
+ - lib/fake_person/titles.rb
29
+ - lib/fake_person/username.rb
30
+ homepage: https://github.com/adamcooke/fake-person
31
+ licenses:
32
+ - MIT
33
+ metadata: {}
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubyforge_project:
50
+ rubygems_version: 2.2.2
51
+ signing_key:
52
+ specification_version: 4
53
+ summary: A Ruby library for creating fake personalities
54
+ test_files: []
55
+ has_rdoc: