faker 2.5.0 → 2.9.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +163 -10
- data/README.md +3 -0
- data/lib/faker/default/address.rb +202 -0
- data/lib/faker/default/ancient.rb +36 -0
- data/lib/faker/default/bank.rb +13 -7
- data/lib/faker/default/beer.rb +72 -0
- data/lib/faker/default/bossa_nova.rb +18 -0
- data/lib/faker/default/business.rb +27 -0
- data/lib/faker/default/chuck_norris.rb +11 -1
- data/lib/faker/default/coffee.rb +45 -0
- data/lib/faker/default/coin.rb +18 -0
- data/lib/faker/default/color.rb +48 -1
- data/lib/faker/default/crypto.rb +27 -0
- data/lib/faker/default/currency.rb +27 -0
- data/lib/faker/default/date.rb +24 -0
- data/lib/faker/default/demographic.rb +57 -0
- data/lib/faker/default/driving_licence.rb +2 -2
- data/lib/faker/default/educator.rb +60 -6
- data/lib/faker/default/esport.rb +45 -0
- data/lib/faker/default/fillmurray.rb +23 -1
- data/lib/faker/default/food.rb +65 -1
- data/lib/faker/default/gender.rb +13 -0
- data/lib/faker/default/id_number.rb +29 -0
- data/lib/faker/default/internet.rb +17 -7
- data/lib/faker/default/job.rb +36 -0
- data/lib/faker/default/kpop.rb +54 -0
- data/lib/faker/default/relationship.rb +45 -0
- data/lib/faker/default/space.rb +127 -0
- data/lib/faker/default/team.rb +45 -0
- data/lib/faker/default/world_cup.rb +50 -0
- data/lib/faker/version.rb +1 -1
- data/lib/locales/en-CA.yml +1 -0
- data/lib/locales/en/educator.yml +69 -6
- data/lib/locales/en/gender.yml +1 -0
- data/lib/locales/en/overwatch.yml +2617 -32
- data/lib/locales/en/super_smash_bros.yml +1 -0
- data/lib/locales/fa.yml +2 -0
- data/lib/locales/fr-CA.yml +1 -1
- data/lib/locales/ja.yml +6 -2
- data/lib/locales/pt-BR.yml +23 -2
- metadata +22 -15
data/lib/faker/default/gender.rb
CHANGED
@@ -28,6 +28,19 @@ module Faker
|
|
28
28
|
def binary_type
|
29
29
|
fetch('gender.binary_types')
|
30
30
|
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# Produces either 'f' or 'm'.
|
34
|
+
#
|
35
|
+
# @return [String]
|
36
|
+
#
|
37
|
+
# @example
|
38
|
+
# Faker::Gender.short_binary_type #=> "f"
|
39
|
+
#
|
40
|
+
# @faker.version next
|
41
|
+
def short_binary_type
|
42
|
+
fetch('gender.short_binary_types')
|
43
|
+
end
|
31
44
|
end
|
32
45
|
end
|
33
46
|
end
|
@@ -16,6 +16,8 @@ module Faker
|
|
16
16
|
BRAZILIAN_ID_FROM = 10_000_000
|
17
17
|
BRAZILIAN_ID_TO = 99_999_999
|
18
18
|
|
19
|
+
CHILEAN_MODULO = 11
|
20
|
+
|
19
21
|
class << self
|
20
22
|
def valid
|
21
23
|
_translate('valid')
|
@@ -105,8 +107,35 @@ module Faker
|
|
105
107
|
|
106
108
|
alias brazilian_rg brazilian_id
|
107
109
|
|
110
|
+
def chilean_id
|
111
|
+
digits = Faker::Number.number(digits: 8)
|
112
|
+
verification_code = chilean_verification_code(digits)
|
113
|
+
|
114
|
+
digits.to_s + '-' + verification_code.to_s
|
115
|
+
end
|
116
|
+
|
108
117
|
private
|
109
118
|
|
119
|
+
def chilean_verification_code(digits)
|
120
|
+
# First digit is multiplied by 3, second by 2, and so on
|
121
|
+
multiplication_rule = [3, 2, 7, 6, 5, 4, 3, 2]
|
122
|
+
digits_splitted = digits.to_s.chars.map(&:to_i)
|
123
|
+
|
124
|
+
sum = digits_splitted.map.with_index { |digit, index| digit * multiplication_rule[index] }.reduce(:+)
|
125
|
+
|
126
|
+
modulo = sum.modulo(CHILEAN_MODULO)
|
127
|
+
difference = CHILEAN_MODULO - modulo
|
128
|
+
|
129
|
+
case difference
|
130
|
+
when 0..9
|
131
|
+
difference
|
132
|
+
when 10
|
133
|
+
'K'
|
134
|
+
when 11
|
135
|
+
0
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
110
139
|
def south_african_id_checksum_digit(id_number)
|
111
140
|
value_parts = id_number.chars
|
112
141
|
even_digits = value_parts
|
@@ -3,16 +3,16 @@
|
|
3
3
|
module Faker
|
4
4
|
class Internet < Base
|
5
5
|
class << self
|
6
|
-
def email(legacy_name = NOT_GIVEN, legacy_separators = NOT_GIVEN, name: nil, separators: nil)
|
6
|
+
def email(legacy_name = NOT_GIVEN, legacy_separators = NOT_GIVEN, name: nil, separators: nil, domain: nil)
|
7
7
|
warn_for_deprecated_arguments do |keywords|
|
8
8
|
keywords << :name if legacy_name != NOT_GIVEN
|
9
9
|
keywords << :separators if legacy_separators != NOT_GIVEN
|
10
10
|
end
|
11
11
|
|
12
12
|
if separators
|
13
|
-
[username(specifier: name, separators: separators), domain_name].join('@')
|
13
|
+
[username(specifier: name, separators: separators), domain_name(domain: domain)].join('@')
|
14
14
|
else
|
15
|
-
[username(specifier: name), domain_name].join('@')
|
15
|
+
[username(specifier: name), domain_name(domain: domain)].join('@')
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -135,15 +135,25 @@ module Faker
|
|
135
135
|
temp
|
136
136
|
end
|
137
137
|
|
138
|
-
def domain_name(legacy_subdomain = NOT_GIVEN, subdomain: false)
|
138
|
+
def domain_name(legacy_subdomain = NOT_GIVEN, subdomain: false, domain: nil)
|
139
139
|
warn_for_deprecated_arguments do |keywords|
|
140
140
|
keywords << :subdomain if legacy_subdomain != NOT_GIVEN
|
141
141
|
end
|
142
142
|
|
143
143
|
with_locale(:en) do
|
144
|
-
|
145
|
-
|
146
|
-
|
144
|
+
if domain
|
145
|
+
domain
|
146
|
+
.split('.')
|
147
|
+
.map { |domain_part| Char.prepare(domain_part) }
|
148
|
+
.tap do |domain_elements|
|
149
|
+
domain_elements << domain_suffix if domain_elements.length < 2
|
150
|
+
domain_elements.unshift(Char.prepare(domain_word)) if subdomain && domain_elements.length < 3
|
151
|
+
end.join('.')
|
152
|
+
else
|
153
|
+
[domain_word, domain_suffix].tap do |domain_elements|
|
154
|
+
domain_elements.unshift(Char.prepare(domain_word)) if subdomain
|
155
|
+
end.join('.')
|
156
|
+
end
|
147
157
|
end
|
148
158
|
end
|
149
159
|
|
data/lib/faker/default/job.rb
CHANGED
@@ -5,18 +5,54 @@ module Faker
|
|
5
5
|
flexible :job
|
6
6
|
|
7
7
|
class << self
|
8
|
+
##
|
9
|
+
# Produces a random job title.
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Faker::Job.title #=> "Construction Manager"
|
15
|
+
#
|
16
|
+
# @faker.version 1.7.0
|
8
17
|
def title
|
9
18
|
parse('job.title')
|
10
19
|
end
|
11
20
|
|
21
|
+
##
|
22
|
+
# Produces a random job position.
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# Faker::Job.position #=> "Strategist"
|
28
|
+
#
|
29
|
+
# @faker.version 1.8.7
|
12
30
|
def position
|
13
31
|
fetch('job.position')
|
14
32
|
end
|
15
33
|
|
34
|
+
##
|
35
|
+
# Produces a random job field.
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# Faker::Job.field #=> "Banking"
|
41
|
+
#
|
42
|
+
# @faker.version 1.7.0
|
16
43
|
def field
|
17
44
|
fetch('job.field')
|
18
45
|
end
|
19
46
|
|
47
|
+
##
|
48
|
+
# Produces a random job skill.
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
# Faker::Job.key_skill #=> "Leadership"
|
54
|
+
#
|
55
|
+
# @faker.version 1.7.0
|
20
56
|
def key_skill
|
21
57
|
fetch('job.key_skills')
|
22
58
|
end
|
data/lib/faker/default/kpop.rb
CHANGED
@@ -3,26 +3,80 @@
|
|
3
3
|
module Faker
|
4
4
|
class Kpop < Base
|
5
5
|
class << self
|
6
|
+
##
|
7
|
+
# Produces the name of a 1990's 'OG' K-Pop group.
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# Faker::Kpop.i_groups #=> "Seo Taiji and Boys"
|
13
|
+
#
|
14
|
+
# @faker.version 1.8.5
|
6
15
|
def i_groups
|
7
16
|
fetch('kpop.i_groups')
|
8
17
|
end
|
9
18
|
|
19
|
+
##
|
20
|
+
# Produces the name of a 2000's K-Pop group.
|
21
|
+
#
|
22
|
+
# @return [String]
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Faker::Kpop.ii_groups #=> "Girls' Generation"
|
26
|
+
#
|
27
|
+
# @faker.version 1.8.5
|
10
28
|
def ii_groups
|
11
29
|
fetch('kpop.ii_groups')
|
12
30
|
end
|
13
31
|
|
32
|
+
##
|
33
|
+
# Produces the name of a 2010's K-Pop group.
|
34
|
+
#
|
35
|
+
# @return [String]
|
36
|
+
#
|
37
|
+
# @example
|
38
|
+
# Faker::Kpop.iii_groups #=> "Trouble Maker"
|
39
|
+
#
|
40
|
+
# @faker.version 1.8.5
|
14
41
|
def iii_groups
|
15
42
|
fetch('kpop.iii_groups')
|
16
43
|
end
|
17
44
|
|
45
|
+
##
|
46
|
+
# Produces the name of a K-Pop girl group.
|
47
|
+
#
|
48
|
+
# @return [String]
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
# Faker::Kpop.girl_groups #=> "2NE1"
|
52
|
+
#
|
53
|
+
# @faker.version 1.8.5
|
18
54
|
def girl_groups
|
19
55
|
fetch('kpop.girl_groups')
|
20
56
|
end
|
21
57
|
|
58
|
+
##
|
59
|
+
# Produces the name of a K-Pop boy band.
|
60
|
+
#
|
61
|
+
# @return [String]
|
62
|
+
#
|
63
|
+
# @example
|
64
|
+
# Faker::Kpop.boy_bands #=> "Exo"
|
65
|
+
#
|
66
|
+
# @faker.version 1.8.5
|
22
67
|
def boy_bands
|
23
68
|
fetch('kpop.boy_bands')
|
24
69
|
end
|
25
70
|
|
71
|
+
##
|
72
|
+
# Produces the name of a solo K-Pop artist.
|
73
|
+
#
|
74
|
+
# @return [String]
|
75
|
+
#
|
76
|
+
# @example
|
77
|
+
# Faker::Kpop.solo #=> "T.O.P"
|
78
|
+
#
|
79
|
+
# @faker.version 1.8.5
|
26
80
|
def solo
|
27
81
|
fetch('kpop.solo')
|
28
82
|
end
|
@@ -5,6 +5,15 @@ module Faker
|
|
5
5
|
flexible :relationship
|
6
6
|
|
7
7
|
class << self
|
8
|
+
##
|
9
|
+
# Produces a random family relationship.
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Faker::Relationship.familial #=> "Grandfather"
|
15
|
+
#
|
16
|
+
# @faker.version 1.9.2
|
8
17
|
def familial(legacy_connection = NOT_GIVEN, connection: nil)
|
9
18
|
warn_for_deprecated_arguments do |keywords|
|
10
19
|
keywords << :connection if legacy_connection != NOT_GIVEN
|
@@ -26,18 +35,54 @@ module Faker
|
|
26
35
|
fetch('relationship.familial.' + connection)
|
27
36
|
end
|
28
37
|
|
38
|
+
##
|
39
|
+
# Produces a random in-law relationship.
|
40
|
+
#
|
41
|
+
# @return [String]
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
# Faker::Relationship.in_law #=> "Brother-in-law"
|
45
|
+
#
|
46
|
+
# @faker.version 1.9.2
|
29
47
|
def in_law
|
30
48
|
fetch('relationship.in_law')
|
31
49
|
end
|
32
50
|
|
51
|
+
##
|
52
|
+
# Produces a random spouse relationship.
|
53
|
+
#
|
54
|
+
# @return [String]
|
55
|
+
#
|
56
|
+
# @example
|
57
|
+
# Faker::Relationship.spouse #=> "Husband"
|
58
|
+
#
|
59
|
+
# @faker.version 1.9.2
|
33
60
|
def spouse
|
34
61
|
fetch('relationship.spouse')
|
35
62
|
end
|
36
63
|
|
64
|
+
##
|
65
|
+
# Produces a random parent relationship.
|
66
|
+
#
|
67
|
+
# @return [String]
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# Faker::Relationship.parent #=> "Father"
|
71
|
+
#
|
72
|
+
# @faker.version 1.9.2
|
37
73
|
def parent
|
38
74
|
fetch('relationship.parent')
|
39
75
|
end
|
40
76
|
|
77
|
+
##
|
78
|
+
# Produces a random sibling relationship.
|
79
|
+
#
|
80
|
+
# @return [String]
|
81
|
+
#
|
82
|
+
# @example
|
83
|
+
# Faker::Relationship.sibling #=> "Sister"
|
84
|
+
#
|
85
|
+
# @faker.version 1.9.2
|
41
86
|
def sibling
|
42
87
|
fetch('relationship.sibling')
|
43
88
|
end
|
data/lib/faker/default/space.rb
CHANGED
@@ -3,59 +3,186 @@
|
|
3
3
|
module Faker
|
4
4
|
class Space < Base
|
5
5
|
flexible :space
|
6
|
+
|
6
7
|
class << self
|
8
|
+
##
|
9
|
+
# Produces the name of a planet.
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Faker::Space.planet #=> "Venus"
|
15
|
+
#
|
16
|
+
# @faker.version 1.6.4
|
7
17
|
def planet
|
8
18
|
fetch('space.planet')
|
9
19
|
end
|
10
20
|
|
21
|
+
##
|
22
|
+
# Produces the name of a moon.
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# Faker::Space.moon #=> "Europa"
|
28
|
+
#
|
29
|
+
# @faker.version 1.6.4
|
11
30
|
def moon
|
12
31
|
fetch('space.moon')
|
13
32
|
end
|
14
33
|
|
34
|
+
##
|
35
|
+
# Produces the name of a galaxy.
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# Faker::Space.galaxy #=> "Andromeda"
|
41
|
+
#
|
42
|
+
# @faker.version 1.6.4
|
15
43
|
def galaxy
|
16
44
|
fetch('space.galaxy')
|
17
45
|
end
|
18
46
|
|
47
|
+
##
|
48
|
+
# Produces the name of a nebula.
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
# Faker::Space.nebula #=> "Triffid Nebula"
|
54
|
+
#
|
55
|
+
# @faker.version 1.6.4
|
19
56
|
def nebula
|
20
57
|
fetch('space.nebula')
|
21
58
|
end
|
22
59
|
|
60
|
+
##
|
61
|
+
# Produces the name of a star cluster.
|
62
|
+
#
|
63
|
+
# @return [String]
|
64
|
+
#
|
65
|
+
# @example
|
66
|
+
# Faker::Space.star_cluster #=> "Messier 70"
|
67
|
+
#
|
68
|
+
# @faker.version 1.6.4
|
23
69
|
def star_cluster
|
24
70
|
fetch('space.star_cluster')
|
25
71
|
end
|
26
72
|
|
73
|
+
##
|
74
|
+
# Produces the name of a constellation.
|
75
|
+
#
|
76
|
+
# @return [String]
|
77
|
+
#
|
78
|
+
# @example
|
79
|
+
# Faker::Space.constellation #=> "Orion"
|
80
|
+
#
|
81
|
+
# @faker.version 1.6.4
|
27
82
|
def constellation
|
28
83
|
fetch('space.constellation')
|
29
84
|
end
|
30
85
|
|
86
|
+
##
|
87
|
+
# Produces the name of a star.
|
88
|
+
#
|
89
|
+
# @return [String]
|
90
|
+
#
|
91
|
+
# @example
|
92
|
+
# Faker::Space.star #=> "Proxima Centauri"
|
93
|
+
#
|
94
|
+
# @faker.version 1.6.4
|
31
95
|
def star
|
32
96
|
fetch('space.star')
|
33
97
|
end
|
34
98
|
|
99
|
+
##
|
100
|
+
# Produces the name of a space agency.
|
101
|
+
#
|
102
|
+
# @return [String]
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
# Faker::Space.agency #=> "Japan Aerospace Exploration Agency"
|
106
|
+
#
|
107
|
+
# @faker.version 1.6.4
|
35
108
|
def agency
|
36
109
|
fetch('space.agency')
|
37
110
|
end
|
38
111
|
|
112
|
+
##
|
113
|
+
# Produces a space agency abbreviation.
|
114
|
+
#
|
115
|
+
# @return [String]
|
116
|
+
#
|
117
|
+
# @example
|
118
|
+
# Faker::Space.agency_abv #=> "NASA"
|
119
|
+
#
|
120
|
+
# @faker.version 1.6.4
|
39
121
|
def agency_abv
|
40
122
|
fetch('space.agency_abv')
|
41
123
|
end
|
42
124
|
|
125
|
+
##
|
126
|
+
# Produces the name of a NASA spacecraft.
|
127
|
+
#
|
128
|
+
# @return [String]
|
129
|
+
#
|
130
|
+
# @example
|
131
|
+
# Faker::Space.nasa_space_craft #=> "Endeavour"
|
132
|
+
#
|
133
|
+
# @faker.version 1.6.4
|
43
134
|
def nasa_space_craft
|
44
135
|
fetch('space.nasa_space_craft')
|
45
136
|
end
|
46
137
|
|
138
|
+
##
|
139
|
+
# Produces the name of a space company.
|
140
|
+
#
|
141
|
+
# @return [String]
|
142
|
+
#
|
143
|
+
# @example
|
144
|
+
# Faker::Space.company #=> "SpaceX"
|
145
|
+
#
|
146
|
+
# @faker.version 1.6.4
|
47
147
|
def company
|
48
148
|
fetch('space.company')
|
49
149
|
end
|
50
150
|
|
151
|
+
##
|
152
|
+
# Produces a distance measurement.
|
153
|
+
#
|
154
|
+
# @return [String]
|
155
|
+
#
|
156
|
+
# @example
|
157
|
+
# Faker::Space.distance_measurement #=> "15 parsecs"
|
158
|
+
#
|
159
|
+
# @faker.version 1.6.4
|
51
160
|
def distance_measurement
|
52
161
|
rand(10..100).to_s + ' ' + fetch('space.distance_measurement')
|
53
162
|
end
|
54
163
|
|
164
|
+
##
|
165
|
+
# Produces the name of a meteorite.
|
166
|
+
#
|
167
|
+
# @return [String]
|
168
|
+
#
|
169
|
+
# @example
|
170
|
+
# Faker::Space.meteorite #=> "Ensisheim"
|
171
|
+
#
|
172
|
+
# @faker.version 1.7.0
|
55
173
|
def meteorite
|
56
174
|
fetch('space.meteorite')
|
57
175
|
end
|
58
176
|
|
177
|
+
##
|
178
|
+
# Produces the name of a launch vehicle.
|
179
|
+
#
|
180
|
+
# @return [String]
|
181
|
+
#
|
182
|
+
# @example
|
183
|
+
# Faker::Space.launch_vehicle #=> "Saturn IV"
|
184
|
+
#
|
185
|
+
# @faker.version 1.9.0
|
59
186
|
def launch_vehicle
|
60
187
|
fetch('space.launch_vehicle')
|
61
188
|
end
|