faker 2.18.0 → 2.21.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 +109 -0
- data/README.md +16 -3
- data/lib/faker/books/the_kingkiller_chronicle.rb +61 -0
- data/lib/faker/default/commerce.rb +28 -0
- data/lib/faker/default/company.rb +5 -7
- data/lib/faker/default/emotion.rb +33 -0
- data/lib/faker/default/finance.rb +13 -0
- data/lib/faker/default/food.rb +13 -0
- data/lib/faker/default/hobby.rb +22 -0
- data/lib/faker/default/internet.rb +40 -16
- data/lib/faker/default/lorem.rb +0 -4
- data/lib/faker/default/markdown.rb +2 -2
- data/lib/faker/default/nation.rb +0 -3
- data/lib/faker/default/omniauth.rb +45 -1
- data/lib/faker/default/placeholdit.rb +9 -9
- data/lib/faker/default/religion.rb +6 -0
- data/lib/faker/default/science.rb +82 -0
- data/lib/faker/default/string.rb +0 -3
- data/lib/faker/default/time.rb +0 -2
- data/lib/faker/games/dota.rb +13 -0
- data/lib/faker/japanese_media/fullmetal_alchemist_brotherhood.rb +48 -0
- data/lib/faker/japanese_media/kamen_rider.rb +102 -0
- data/lib/faker/locations/australia.rb +47 -0
- data/lib/faker/movies/tron.rb +161 -0
- data/lib/faker/music/hiphop.rb +3 -3
- data/lib/faker/religion/bible.rb +50 -0
- data/lib/faker/tv_shows/brooklyn_nine_nine.rb +38 -0
- data/lib/faker/tv_shows/michael_scott.rb +0 -3
- data/lib/faker/tv_shows/supernatural.rb +48 -0
- data/lib/faker/tv_shows/the_office.rb +37 -0
- data/lib/faker/version.rb +2 -2
- data/lib/locales/ar.yml +5 -1
- data/lib/locales/de-AT.yml +2 -2
- data/lib/locales/de.yml +7 -3
- data/lib/locales/en/address.yml +2 -3
- data/lib/locales/en/animal.yml +1 -1
- data/lib/locales/en/australia.yml +108 -0
- data/lib/locales/en/bible.yml +90 -0
- data/lib/locales/en/brooklyn_nine_nine.yml +35 -0
- data/lib/locales/en/cat.yml +1 -1
- data/lib/locales/en/coffee.yml +1 -1
- data/lib/locales/en/commerce.yml +17 -0
- data/lib/locales/en/community.yml +17 -17
- data/lib/locales/en/dota.yml +7 -0
- data/lib/locales/en/emotion.yml +480 -0
- data/lib/locales/en/finance.yml +21 -0
- data/lib/locales/en/fma_brotherhood.yml +78 -0
- data/lib/locales/en/food.yml +1054 -10
- data/lib/locales/en/game.yml +11 -0
- data/lib/locales/en/hobby.yml +171 -0
- data/lib/locales/en/horse.yml +2 -2
- data/lib/locales/en/internet.yml +108 -3
- data/lib/locales/en/kamen_rider.yml +452 -0
- data/lib/locales/en/kpop.yml +7 -7
- data/lib/locales/en/mountain.yml +14 -1
- data/lib/locales/en/movie.yml +2 -1
- data/lib/locales/en/music.yml +142 -142
- data/lib/locales/en/naruto.yml +2 -3
- data/lib/locales/en/science.yml +126 -0
- data/lib/locales/en/stranger_thing.yml +1 -1
- data/lib/locales/en/super_smash_bros.yml +5 -2
- data/lib/locales/en/supernatural.yml +141 -0
- data/lib/locales/en/the_kingkiller_chronicle.yml +56 -0
- data/lib/locales/en/the_office.yml +86 -0
- data/lib/locales/en/touhou.yml +1 -1
- data/lib/locales/en/tron.yml +227 -0
- data/lib/locales/en-US.yml +1 -1
- data/lib/locales/es-AR.yml +1 -4
- data/lib/locales/fr/adjective.yml +266 -0
- data/lib/locales/fr/animal.yml +5 -0
- data/lib/locales/fr/appliance.yml +4 -0
- data/lib/locales/fr/pokemon.yml +0 -2
- data/lib/locales/ja/address.yml +120523 -1
- data/lib/locales/ja/animal.yml +5 -0
- data/lib/locales/ja/cat.yml +5 -0
- data/lib/locales/ja/color.yml +1 -1
- data/lib/locales/ja/{creature.yml → dog.yml} +0 -4
- data/lib/locales/ja/emotion.yml +51 -0
- data/lib/locales/ja/lorem.yml +2 -2
- data/lib/locales/ja/naruto.yml +230 -0
- data/lib/locales/ja/overwatch.yml +5 -0
- data/lib/locales/ja/{games.yml → pokemon.yml} +0 -11
- data/lib/locales/ja/relationship.yml +10 -0
- data/lib/locales/ja/studio_ghibli.yml +112 -0
- data/lib/locales/ja/super_mario.yml +9 -0
- data/lib/locales/ja/super_smash_bros.yml +8 -0
- data/lib/locales/ja/zelda.yml +5 -0
- data/lib/locales/lt.yml +35 -0
- data/lib/locales/lv.yml +1 -1
- data/lib/locales/mi-NZ.yml +281 -0
- data/lib/locales/pt-BR.yml +7 -2
- metadata +60 -22
|
@@ -65,7 +65,7 @@ module Faker
|
|
|
65
65
|
picture: image,
|
|
66
66
|
gender: gender,
|
|
67
67
|
birthday: Date.backward(days: 36_400).strftime('%Y-%m-%d'),
|
|
68
|
-
|
|
68
|
+
locale: 'en',
|
|
69
69
|
hd: "#{Company.name.downcase}.com"
|
|
70
70
|
},
|
|
71
71
|
id_info: {
|
|
@@ -431,6 +431,50 @@ module Faker
|
|
|
431
431
|
}
|
|
432
432
|
end
|
|
433
433
|
|
|
434
|
+
##
|
|
435
|
+
# Generate a mock Omniauth response from Auth0.
|
|
436
|
+
#
|
|
437
|
+
# @param name [String] A specific name to return in the response.
|
|
438
|
+
# @param email [String] A specific email to return in the response.
|
|
439
|
+
# @param uid [String] A specific UID to return in the response.
|
|
440
|
+
#
|
|
441
|
+
# @return [Hash] An auth hash in the format provided by omniauth-auth0.
|
|
442
|
+
#
|
|
443
|
+
# @faker.version next
|
|
444
|
+
def auth0(name: nil, email: nil, uid: nil)
|
|
445
|
+
uid ||= "auth0|#{Number.hexadecimal(digits: 24)}"
|
|
446
|
+
auth = Omniauth.new(name: name, email: email)
|
|
447
|
+
{
|
|
448
|
+
provider: 'auth0',
|
|
449
|
+
uid: uid,
|
|
450
|
+
info: {
|
|
451
|
+
name: uid,
|
|
452
|
+
nickname: auth.name,
|
|
453
|
+
email: auth.email,
|
|
454
|
+
image: image
|
|
455
|
+
},
|
|
456
|
+
credentials: {
|
|
457
|
+
expires_at: Time.forward.to_i,
|
|
458
|
+
expires: true,
|
|
459
|
+
token_type: 'Bearer',
|
|
460
|
+
id_token: Crypto.sha256,
|
|
461
|
+
token: Crypto.md5,
|
|
462
|
+
refresh_token: Crypto.md5
|
|
463
|
+
},
|
|
464
|
+
extra: {
|
|
465
|
+
raw_info: {
|
|
466
|
+
email: auth.email,
|
|
467
|
+
email_verified: true,
|
|
468
|
+
iss: 'https://auth0.com/',
|
|
469
|
+
sub: uid,
|
|
470
|
+
aud: 'Auth012345',
|
|
471
|
+
iat: Time.forward.to_i,
|
|
472
|
+
exp: Time.forward.to_i
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
end
|
|
477
|
+
|
|
434
478
|
private
|
|
435
479
|
|
|
436
480
|
def gender
|
|
@@ -8,7 +8,7 @@ module Faker
|
|
|
8
8
|
# rubocop:disable Metrics/ParameterLists
|
|
9
9
|
|
|
10
10
|
##
|
|
11
|
-
# Produces a random placeholder image from https://
|
|
11
|
+
# Produces a random placeholder image from https://via.placeholder.com.
|
|
12
12
|
#
|
|
13
13
|
# @param size [String] Specifies the image's size, dimensions separated by 'x'.
|
|
14
14
|
# @param format [String] Specifies the image's extension.
|
|
@@ -19,13 +19,13 @@ module Faker
|
|
|
19
19
|
#
|
|
20
20
|
# @example
|
|
21
21
|
# # Keyword arguments: size, format, background_color, text_color, text
|
|
22
|
-
# Faker::Placeholdit.image #=> "https://
|
|
23
|
-
# Faker::Placeholdit.image(size: '50x50') #=> "https://
|
|
24
|
-
# Faker::Placeholdit.image(size: '50x50', format: 'jpg') #=> "https://
|
|
25
|
-
# Faker::Placeholdit.image(size: '50x50', format: 'gif', background_color: 'ffffff') #=> "https://
|
|
26
|
-
# Faker::Placeholdit.image(size: '50x50', format: 'jpeg', background_color: :random) #=> "https://
|
|
27
|
-
# Faker::Placeholdit.image(size: '50x50', format: 'jpeg', background_color: 'ffffff', text_color: '000') #=> "https://
|
|
28
|
-
# Faker::Placeholdit.image(size: '50x50', format: 'jpg', background_color: 'ffffff', text_color: '000', text: 'Some Custom Text') #=> "https://
|
|
22
|
+
# Faker::Placeholdit.image #=> "https://via.placeholder.com/300x300.png"
|
|
23
|
+
# Faker::Placeholdit.image(size: '50x50') #=> "https://via.placeholder.com/50x50.png"
|
|
24
|
+
# Faker::Placeholdit.image(size: '50x50', format: 'jpg') #=> "https://via.placeholder.com/50x50.jpg"
|
|
25
|
+
# Faker::Placeholdit.image(size: '50x50', format: 'gif', background_color: 'ffffff') #=> "https://via.placeholder.com/50x50.gif/ffffff"
|
|
26
|
+
# Faker::Placeholdit.image(size: '50x50', format: 'jpeg', background_color: :random) #=> "https://via.placeholder.com/50x50.jpeg/39eba7"
|
|
27
|
+
# Faker::Placeholdit.image(size: '50x50', format: 'jpeg', background_color: 'ffffff', text_color: '000') #=> "https://via.placeholder.com/50x50.jpeg/ffffff/000"
|
|
28
|
+
# Faker::Placeholdit.image(size: '50x50', format: 'jpg', background_color: 'ffffff', text_color: '000', text: 'Some Custom Text') #=> "https://via.placeholder.com/50x50.jpg/ffffff/000?text=Some Custom Text"
|
|
29
29
|
#
|
|
30
30
|
# @faker.version 1.6.0
|
|
31
31
|
def image(legacy_size = NOT_GIVEN, legacy_format = NOT_GIVEN, legacy_background_color = NOT_GIVEN, legacy_text_color = NOT_GIVEN, legacy_text = NOT_GIVEN, size: '300x300', format: 'png', background_color: nil, text_color: nil, text: nil)
|
|
@@ -45,7 +45,7 @@ module Faker
|
|
|
45
45
|
raise ArgumentError, "background_color must be a hex value without '#'" unless background_color.nil? || background_color =~ /((?:^\h{3}$)|(?:^\h{6}$)){1}(?!.*\H)/
|
|
46
46
|
raise ArgumentError, "text_color must be a hex value without '#'" unless text_color.nil? || text_color =~ /((?:^\h{3}$)|(?:^\h{6}$)){1}(?!.*\H)/
|
|
47
47
|
|
|
48
|
-
image_url = "https://
|
|
48
|
+
image_url = "https://via.placeholder.com/#{size}.#{format}"
|
|
49
49
|
image_url += "/#{background_color}" if background_color
|
|
50
50
|
image_url += "/#{text_color}" if text_color
|
|
51
51
|
image_url += "?text=#{text}" if text
|
|
@@ -3,6 +3,47 @@
|
|
|
3
3
|
module Faker
|
|
4
4
|
class Science < Base
|
|
5
5
|
class << self
|
|
6
|
+
BRANCHES = {
|
|
7
|
+
empirical: %i[empirical_natural_basic empirical_natural_applied empirical_social_basic empirical_social_applied],
|
|
8
|
+
formal: %i[formal_basic formal_applied],
|
|
9
|
+
natural: %i[empirical_natural_basic empirical_natural_applied],
|
|
10
|
+
social: %i[empirical_social_basic empirical_social_applied],
|
|
11
|
+
basic: %i[empirical_natural_basic empirical_social_basic formal_basic],
|
|
12
|
+
applied: %i[empirical_natural_applied empirical_social_applied formal_applied]
|
|
13
|
+
}.freeze
|
|
14
|
+
|
|
15
|
+
##
|
|
16
|
+
# Produces a name of a science
|
|
17
|
+
# You can optionally filter by specifying one or more of the following:
|
|
18
|
+
# `:empirical, :formal, :natural, :social, :basic, :applied`
|
|
19
|
+
# @see https://en.wikipedia.org/wiki/Science#Branches_of_science
|
|
20
|
+
# @see Faker::Educator.subject
|
|
21
|
+
#
|
|
22
|
+
# @param branches [Array<Symbol>]
|
|
23
|
+
# @return [String]
|
|
24
|
+
#
|
|
25
|
+
# @example
|
|
26
|
+
# Faker::Science.science #=> "Space science"
|
|
27
|
+
# Faker::Science.science(:natural, :applied) #=> "Engineering"
|
|
28
|
+
# Faker::Science.science(:formal, :applied) #=> "Computer Science"
|
|
29
|
+
#
|
|
30
|
+
# @faker.version next
|
|
31
|
+
def science(*branches)
|
|
32
|
+
selected = BRANCHES.values.flatten.uniq
|
|
33
|
+
branches.each do |branch|
|
|
34
|
+
selected &= BRANCHES[branch] if BRANCHES.key? branch
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
raise ArgumentError, 'Filters do not match any sciences' if selected.empty?
|
|
38
|
+
|
|
39
|
+
sciences = []
|
|
40
|
+
selected.each do |branch|
|
|
41
|
+
sciences += translate("faker.science.branch.#{branch}")
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
sample(sciences)
|
|
45
|
+
end
|
|
46
|
+
|
|
6
47
|
##
|
|
7
48
|
# Produces the name of a element.
|
|
8
49
|
#
|
|
@@ -67,6 +108,47 @@ module Faker
|
|
|
67
108
|
def scientist
|
|
68
109
|
fetch('science.scientist')
|
|
69
110
|
end
|
|
111
|
+
|
|
112
|
+
##
|
|
113
|
+
# Produces a scientifically sounding word
|
|
114
|
+
#
|
|
115
|
+
# @return [String]
|
|
116
|
+
#
|
|
117
|
+
# @example
|
|
118
|
+
# Faker::Science.modifier #=> "Quantum"
|
|
119
|
+
# Faker::Science.modifier #=> "Superconductive"
|
|
120
|
+
#
|
|
121
|
+
# @faker.version next
|
|
122
|
+
def modifier
|
|
123
|
+
fetch('science.modifier')
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
##
|
|
127
|
+
# Produces the name of a scientific tool.
|
|
128
|
+
# By default it uses a science word modifier to generate more diverse data, which can be disabled.
|
|
129
|
+
#
|
|
130
|
+
# @param simple [Boolean] Whether to generate simple realistic tool names, (no Q-word).
|
|
131
|
+
# @return [String]
|
|
132
|
+
#
|
|
133
|
+
# @example
|
|
134
|
+
# Faker::Science.tool #=> "Superconductive Microcentrifuge"
|
|
135
|
+
# Faker::Science.tool #=> "Portable Cryostat"
|
|
136
|
+
# Faker::Science.tool #=> "Quantum Spectrophotometer"
|
|
137
|
+
# Faker::Science.tool(simple: true) #=> "Microcentrifuge"
|
|
138
|
+
#
|
|
139
|
+
# @faker.version next
|
|
140
|
+
def tool(simple: false)
|
|
141
|
+
tool = fetch('science.tool')
|
|
142
|
+
return tool if simple
|
|
143
|
+
|
|
144
|
+
# Makes sure the modifier are different
|
|
145
|
+
loop do
|
|
146
|
+
modifier = self.modifier
|
|
147
|
+
break unless tool.start_with?(modifier)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
"#{modifier} #{tool}"
|
|
151
|
+
end
|
|
70
152
|
end
|
|
71
153
|
end
|
|
72
154
|
end
|
data/lib/faker/default/string.rb
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
module Faker
|
|
4
4
|
class String < Base
|
|
5
5
|
class << self
|
|
6
|
-
# rubocop:disable Style/AsciiComments
|
|
7
|
-
|
|
8
6
|
##
|
|
9
7
|
# Produces a random UTF-8 string with optional nested length selectors.
|
|
10
8
|
#
|
|
@@ -26,7 +24,6 @@ module Faker
|
|
|
26
24
|
|
|
27
25
|
utf8string select_a length
|
|
28
26
|
end
|
|
29
|
-
# rubocop:enable Style/AsciiComments
|
|
30
27
|
|
|
31
28
|
private
|
|
32
29
|
|
data/lib/faker/default/time.rb
CHANGED
|
@@ -14,7 +14,6 @@ module Faker
|
|
|
14
14
|
|
|
15
15
|
class << self
|
|
16
16
|
# rubocop:disable Metrics/ParameterLists
|
|
17
|
-
# rubocop:disable Style/AsciiComments
|
|
18
17
|
|
|
19
18
|
##
|
|
20
19
|
# Produce a random time between two times.
|
|
@@ -51,7 +50,6 @@ module Faker
|
|
|
51
50
|
time = Faker::Base.rand_in_range(from, to)
|
|
52
51
|
time_with_format(time, format)
|
|
53
52
|
end
|
|
54
|
-
# rubocop:enable Style/AsciiComments
|
|
55
53
|
|
|
56
54
|
##
|
|
57
55
|
# Produce a random time between two dates.
|
data/lib/faker/games/dota.rb
CHANGED
|
@@ -4,6 +4,19 @@ module Faker
|
|
|
4
4
|
class Games
|
|
5
5
|
class Dota < Base
|
|
6
6
|
class << self
|
|
7
|
+
##
|
|
8
|
+
# Produces the name of a building from Dota.
|
|
9
|
+
#
|
|
10
|
+
# @return [String]
|
|
11
|
+
#
|
|
12
|
+
# @example
|
|
13
|
+
# Faker::Games::Dota.building #=> "Tower"
|
|
14
|
+
#
|
|
15
|
+
# @faker.version 1.9.0
|
|
16
|
+
def building
|
|
17
|
+
fetch('games.dota.building')
|
|
18
|
+
end
|
|
19
|
+
|
|
7
20
|
##
|
|
8
21
|
# Produces the name of a hero from Dota.
|
|
9
22
|
#
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faker
|
|
4
|
+
class JapaneseMedia
|
|
5
|
+
class FmaBrotherhood < Base
|
|
6
|
+
class << self
|
|
7
|
+
##
|
|
8
|
+
# Produces a character from FmaBrotherhood.
|
|
9
|
+
#
|
|
10
|
+
# @return [String]
|
|
11
|
+
#
|
|
12
|
+
# @example
|
|
13
|
+
# Faker::JapaneseMedia::FmaBrotherhood.character #=> "Edward Elric"
|
|
14
|
+
#
|
|
15
|
+
# @faker.version next
|
|
16
|
+
def character
|
|
17
|
+
fetch('fma_brotherhood.characters')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
##
|
|
21
|
+
# Produces a cities from FmaBrotherhood.
|
|
22
|
+
#
|
|
23
|
+
# @return [String]
|
|
24
|
+
#
|
|
25
|
+
# @example
|
|
26
|
+
# Faker::JapaneseMedia::FmaBrotherhood.city #=> "Central City"
|
|
27
|
+
#
|
|
28
|
+
# @faker.version next
|
|
29
|
+
def city
|
|
30
|
+
fetch('fma_brotherhood.cities')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
##
|
|
34
|
+
# Produces a country from FmaBrotherhood.
|
|
35
|
+
#
|
|
36
|
+
# @return [String]
|
|
37
|
+
#
|
|
38
|
+
# @example
|
|
39
|
+
# Faker::JapaneseMedia::FmaBrotherhood.country #=> "Xing"
|
|
40
|
+
#
|
|
41
|
+
# @faker.version next
|
|
42
|
+
def country
|
|
43
|
+
fetch('fma_brotherhood.countries')
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faker
|
|
4
|
+
class JapaneseMedia
|
|
5
|
+
class KamenRider < Base
|
|
6
|
+
class << self
|
|
7
|
+
ERAS = %i[showa heisei reiwa].freeze
|
|
8
|
+
|
|
9
|
+
def eras=(new_eras)
|
|
10
|
+
selected_eras = ERAS & new_eras
|
|
11
|
+
@eras = selected_eras.empty? ? ERAS : selected_eras
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
##
|
|
15
|
+
# Produces the name of a Kamen Rider from a series in the given era.
|
|
16
|
+
#
|
|
17
|
+
# @return [String]
|
|
18
|
+
#
|
|
19
|
+
# @example
|
|
20
|
+
# Faker::JapaneseMedia::KamenRider.kamen_rider #=> "Kamen Rider Revice"
|
|
21
|
+
#
|
|
22
|
+
# @faker.version next
|
|
23
|
+
def kamen_rider(*eras)
|
|
24
|
+
from_eras(*eras, field: :kamen_riders)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
##
|
|
28
|
+
# Produces the name of a main user of Kamen Rider.
|
|
29
|
+
#
|
|
30
|
+
# @return [String]
|
|
31
|
+
#
|
|
32
|
+
# @example
|
|
33
|
+
# Faker::JapaneseMedia::KamenRider.user #=> "Ikki Igarashi"
|
|
34
|
+
#
|
|
35
|
+
# @faker.version next
|
|
36
|
+
def user(*eras)
|
|
37
|
+
from_eras(*eras, field: :users)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
##
|
|
41
|
+
# Produces the name of a Kamen Rider series.
|
|
42
|
+
#
|
|
43
|
+
# @return [String]
|
|
44
|
+
#
|
|
45
|
+
# @example
|
|
46
|
+
# Faker::JapaneseMedia::KamenRider.series #=> "Kamen Rider Revice"
|
|
47
|
+
#
|
|
48
|
+
# @faker.version next
|
|
49
|
+
def series(*eras)
|
|
50
|
+
from_eras(*eras, field: :series)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
##
|
|
54
|
+
# Produces the name of a collectible device from a Kamen Rider series.
|
|
55
|
+
#
|
|
56
|
+
# @return [String]
|
|
57
|
+
#
|
|
58
|
+
# @example
|
|
59
|
+
# Faker::JapaneseMedia::KamenRider.collectible_device #=> "Vistamp"
|
|
60
|
+
#
|
|
61
|
+
# @faker.version next
|
|
62
|
+
def collectible_device(*eras)
|
|
63
|
+
from_eras(*eras, field: :collectible_devices) { |e| e.delete(:showa) }
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Produces the name of a transformation device used by a Kamen Rider
|
|
67
|
+
# from the given eras.
|
|
68
|
+
#
|
|
69
|
+
# @return [String]
|
|
70
|
+
#
|
|
71
|
+
# @example Faker::JapaneseMedia::KamenRider.transformation_device #=>
|
|
72
|
+
# "Revice Driver"
|
|
73
|
+
#
|
|
74
|
+
# @faker.version next
|
|
75
|
+
def transformation_device(*eras)
|
|
76
|
+
from_eras(*eras, field: :transformation_devices)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
private
|
|
80
|
+
|
|
81
|
+
def eras
|
|
82
|
+
@eras ||= ERAS
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def from_eras(*input_eras, field:)
|
|
86
|
+
selected_eras = (ERAS & input_eras).yield_self do |selected|
|
|
87
|
+
selected.empty? ? eras : selected
|
|
88
|
+
end.dup
|
|
89
|
+
yield(selected_eras) if block_given?
|
|
90
|
+
|
|
91
|
+
raise UnavailableInEra, "#{field} is unavailable in the selected eras." if selected_eras.empty?
|
|
92
|
+
|
|
93
|
+
selected_eras.sample.yield_self do |era|
|
|
94
|
+
fetch("kamen_rider.#{era}.#{field}")
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
class UnavailableInEra < StandardError; end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faker
|
|
4
|
+
class Australia < Base
|
|
5
|
+
class << self
|
|
6
|
+
##
|
|
7
|
+
# Produces a location in Australia
|
|
8
|
+
#
|
|
9
|
+
# @return [String]
|
|
10
|
+
#
|
|
11
|
+
# @example
|
|
12
|
+
# Faker::Australia.location
|
|
13
|
+
# #=> "Sydney"
|
|
14
|
+
#
|
|
15
|
+
# @faker.version next
|
|
16
|
+
def location
|
|
17
|
+
fetch('australia.locations')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Produces an Australian animal
|
|
21
|
+
#
|
|
22
|
+
# @return [String]
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
# Faker::Australia.animal
|
|
26
|
+
# #=> "Dingo"
|
|
27
|
+
#
|
|
28
|
+
# @faker.version next
|
|
29
|
+
def animal
|
|
30
|
+
fetch('australia.animals')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Produces an Australian State or Territory
|
|
34
|
+
#
|
|
35
|
+
# @return [String]
|
|
36
|
+
#
|
|
37
|
+
# @example
|
|
38
|
+
# Faker::Australia.state
|
|
39
|
+
# #=> "New South Wales"
|
|
40
|
+
#
|
|
41
|
+
# @faker.version next
|
|
42
|
+
def state
|
|
43
|
+
fetch('australia.states')
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faker
|
|
4
|
+
class Movies
|
|
5
|
+
class Tron < Base
|
|
6
|
+
class << self
|
|
7
|
+
##
|
|
8
|
+
# Produces a character from Tron.
|
|
9
|
+
#
|
|
10
|
+
# @return [String]
|
|
11
|
+
#
|
|
12
|
+
# @example
|
|
13
|
+
# Faker::Movies::Tron.character #=> "Bit"
|
|
14
|
+
#
|
|
15
|
+
# @faker.version next
|
|
16
|
+
def character
|
|
17
|
+
sample(characters)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
##
|
|
21
|
+
# Produces a game from Tron.
|
|
22
|
+
#
|
|
23
|
+
# @return [String]
|
|
24
|
+
#
|
|
25
|
+
# @example
|
|
26
|
+
# Faker::Movies::Tron.game #=> "Space Paranoids"
|
|
27
|
+
#
|
|
28
|
+
# @faker.version next
|
|
29
|
+
def game
|
|
30
|
+
sample(games)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
##
|
|
34
|
+
# Produces a location from Tron.
|
|
35
|
+
#
|
|
36
|
+
# @return [String]
|
|
37
|
+
#
|
|
38
|
+
# @example
|
|
39
|
+
# Faker::Movies::Tron.location #=> "Flynn's Arcade"
|
|
40
|
+
#
|
|
41
|
+
# @faker.version next
|
|
42
|
+
def location
|
|
43
|
+
sample(locations)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
##
|
|
47
|
+
# Produces a program from Tron.
|
|
48
|
+
#
|
|
49
|
+
# @return [String]
|
|
50
|
+
#
|
|
51
|
+
# @example
|
|
52
|
+
# Faker::Movies::Tron.program #=> "Clu"
|
|
53
|
+
#
|
|
54
|
+
# @faker.version next
|
|
55
|
+
def program
|
|
56
|
+
sample(programs)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
##
|
|
60
|
+
# Produces a quote from Tron.
|
|
61
|
+
#
|
|
62
|
+
# @param character [String] The name of a character to derive a quote from.
|
|
63
|
+
# @return [String]
|
|
64
|
+
#
|
|
65
|
+
# @example
|
|
66
|
+
# Faker::Movies::Tron.quote #=> "Greetings, Programs!"
|
|
67
|
+
#
|
|
68
|
+
# @example
|
|
69
|
+
# Faker::Movies::Tron.quote(character: "mcp")
|
|
70
|
+
# #=> "End of Line."
|
|
71
|
+
#
|
|
72
|
+
# @faker.version next
|
|
73
|
+
def quote(character: nil)
|
|
74
|
+
quoted_characters = translate('faker.tron.quotes')
|
|
75
|
+
|
|
76
|
+
if character.nil?
|
|
77
|
+
character = sample(quoted_characters.keys).to_s
|
|
78
|
+
else
|
|
79
|
+
character = character.to_s.downcase
|
|
80
|
+
|
|
81
|
+
# check alternate spellings, nicknames, titles of characters
|
|
82
|
+
translate('faker.tron.alternate_character_spellings').each do |k, v|
|
|
83
|
+
character = k.to_s if v.include?(character)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
raise ArgumentError, "Character for quotes can be left blank or #{quoted_characters.keys.join(', ')}" unless quoted_characters.key?(character.to_sym)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
fetch("tron.quotes.#{character}")
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
##
|
|
93
|
+
# Produces a tagline from Tron.
|
|
94
|
+
#
|
|
95
|
+
# @return [String]
|
|
96
|
+
#
|
|
97
|
+
# @example
|
|
98
|
+
# Faker::Movies::Tron.tagline #=> "The Electronic Gladiator"
|
|
99
|
+
#
|
|
100
|
+
# @faker.version next
|
|
101
|
+
def tagline
|
|
102
|
+
sample(taglines)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
##
|
|
106
|
+
# Produces a user from Tron.
|
|
107
|
+
#
|
|
108
|
+
# @return [String]
|
|
109
|
+
#
|
|
110
|
+
# @example
|
|
111
|
+
# Faker::Movies::Tron.user #=> "Light Cycle"
|
|
112
|
+
#
|
|
113
|
+
# @faker.version next
|
|
114
|
+
def user
|
|
115
|
+
sample(users)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
##
|
|
119
|
+
# Produces a vehicle from Tron.
|
|
120
|
+
#
|
|
121
|
+
# @return [String]
|
|
122
|
+
#
|
|
123
|
+
# @example
|
|
124
|
+
# Faker::Movies::Tron.vehicle #=> "Light Cycle"
|
|
125
|
+
#
|
|
126
|
+
# @faker.version next
|
|
127
|
+
def vehicle
|
|
128
|
+
sample(vehicles)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def characters
|
|
132
|
+
translate('faker.tron.characters').values.flatten
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def games
|
|
136
|
+
fetch_all('tron.games')
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def locations
|
|
140
|
+
fetch_all('tron.locations')
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def programs
|
|
144
|
+
fetch_all('tron.characters.programs')
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def taglines
|
|
148
|
+
fetch_all('tron.taglines')
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def users
|
|
152
|
+
fetch_all('tron.characters.users')
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def vehicles
|
|
156
|
+
fetch_all('tron.vehicles')
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
end
|
data/lib/faker/music/hiphop.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Faker
|
|
|
14
14
|
#
|
|
15
15
|
# @faker.version next
|
|
16
16
|
def artist
|
|
17
|
-
fetch('hiphop.artist')
|
|
17
|
+
fetch('music.hiphop.artist')
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
##
|
|
@@ -27,7 +27,7 @@ module Faker
|
|
|
27
27
|
#
|
|
28
28
|
# @faker.version next
|
|
29
29
|
def groups
|
|
30
|
-
fetch('hiphop.groups')
|
|
30
|
+
fetch('music.hiphop.groups')
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
##
|
|
@@ -40,7 +40,7 @@ module Faker
|
|
|
40
40
|
#
|
|
41
41
|
# @faker.version next
|
|
42
42
|
def subgenres
|
|
43
|
-
fetch('hiphop.subgenres')
|
|
43
|
+
fetch('music.hiphop.subgenres')
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faker
|
|
4
|
+
module Religion
|
|
5
|
+
class Bible < Base
|
|
6
|
+
flexible :bible
|
|
7
|
+
|
|
8
|
+
class << self
|
|
9
|
+
##
|
|
10
|
+
# Returns a random bible character.
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
#
|
|
14
|
+
# @example
|
|
15
|
+
# Faker::Religion::Bible.character #=> "Jesus"
|
|
16
|
+
#
|
|
17
|
+
# @faker.version next
|
|
18
|
+
def character
|
|
19
|
+
fetch('bible.character')
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
# Returns a random location(city or town) from the bible
|
|
24
|
+
#
|
|
25
|
+
# @return [String]
|
|
26
|
+
#
|
|
27
|
+
# @example
|
|
28
|
+
# Faker::Religion::Bible.location #=> "Nasareth"
|
|
29
|
+
#
|
|
30
|
+
# @faker.version next
|
|
31
|
+
def location
|
|
32
|
+
fetch('bible.location')
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
##
|
|
36
|
+
# Returns a random quote from the location.
|
|
37
|
+
#
|
|
38
|
+
# @return [String]
|
|
39
|
+
#
|
|
40
|
+
# @example
|
|
41
|
+
# Faker::Religion::Bible.quote #=> "Seek first the kingdom of God "
|
|
42
|
+
#
|
|
43
|
+
# @faker.version next
|
|
44
|
+
def quote
|
|
45
|
+
fetch('bible.quote')
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|