faker 2.3.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +118 -2
- data/README.md +5 -1
- data/lib/faker/blockchain/aeternity.rb +70 -0
- data/lib/faker/default/app.rb +2 -1
- data/lib/faker/default/appliance.rb +18 -0
- data/lib/faker/default/avatar.rb +2 -1
- data/lib/faker/default/chuck_norris.rb +1 -1
- data/lib/faker/default/date.rb +83 -2
- data/lib/faker/default/dessert.rb +27 -0
- data/lib/faker/default/device.rb +54 -0
- data/lib/faker/default/driving_licence.rb +2 -2
- data/lib/faker/default/electrical_components.rb +27 -0
- data/lib/faker/default/greek_philosophers.rb +18 -0
- data/lib/faker/default/id_number.rb +29 -0
- data/lib/faker/default/industry_segments.rb +36 -0
- data/lib/faker/default/internet.rb +4 -1
- data/lib/faker/default/marketing.rb +9 -0
- data/lib/faker/default/military.rb +45 -0
- data/lib/faker/default/nation.rb +48 -5
- data/lib/faker/default/nato_phonetic_alphabet.rb +9 -0
- data/lib/faker/default/number.rb +124 -0
- data/lib/faker/default/restaurant.rb +54 -2
- data/lib/faker/default/science.rb +27 -0
- data/lib/faker/default/subscription.rb +45 -0
- data/lib/faker/default/superhero.rb +45 -0
- data/lib/faker/default/time.rb +85 -8
- data/lib/faker/default/world_cup.rb +50 -0
- data/lib/faker/games/dota.rb +47 -0
- data/lib/faker/games/heroes.rb +27 -0
- data/lib/faker/games/heroes_of_the_storm.rb +36 -0
- data/lib/faker/games/league_of_legends.rb +54 -0
- data/lib/faker/games/myst.rb +45 -0
- data/lib/faker/games/pokemon.rb +27 -0
- data/lib/faker/games/sonic_the_hedgehog.rb +27 -0
- data/lib/faker/games/witcher.rb +54 -0
- data/lib/faker/games/world_of_warcraft.rb +18 -0
- data/lib/faker/games/zelda.rb +1 -1
- data/lib/faker/japanese_media/dragon_ball.rb +9 -0
- data/lib/faker/japanese_media/one_piece.rb +54 -0
- data/lib/faker/japanese_media/sword_art_online.rb +36 -0
- data/lib/faker/movies/back_to_the_future.rb +28 -0
- data/lib/faker/movies/ghostbusters.rb +28 -0
- data/lib/faker/movies/harry_potter.rb +54 -0
- data/lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb +69 -0
- data/lib/faker/movies/hobbit.rb +37 -0
- data/lib/faker/movies/lebowski.rb +27 -0
- data/lib/faker/movies/lord_of_the_rings.rb +28 -0
- data/lib/faker/movies/movie.rb +9 -0
- data/lib/faker/movies/princess_bride.rb +19 -0
- data/lib/faker/movies/star_wars.rb +94 -0
- data/lib/faker/movies/v_for_vendetta.rb +29 -0
- data/lib/faker/music/grateful_dead.rb +18 -0
- data/lib/faker/music/phish.rb +9 -0
- data/lib/faker/music/rock_band.rb +9 -0
- data/lib/faker/music/umphreys_mcgee.rb +9 -0
- data/lib/faker/sports/basketball.rb +36 -0
- data/lib/faker/sports/football.rb +45 -0
- data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +9 -0
- data/lib/faker/tv_shows/bojack_horseman.rb +28 -0
- data/lib/faker/tv_shows/buffy.rb +45 -0
- data/lib/faker/tv_shows/community.rb +19 -0
- data/lib/faker/tv_shows/dr_who.rb +78 -2
- data/lib/faker/tv_shows/dumb_and_dumber.rb +28 -0
- data/lib/faker/tv_shows/family_guy.rb +28 -0
- data/lib/faker/tv_shows/friends.rb +27 -0
- data/lib/faker/tv_shows/game_of_thrones.rb +46 -0
- data/lib/faker/tv_shows/hey_arnold.rb +27 -0
- data/lib/faker/tv_shows/how_i_met_your_mother.rb +37 -0
- data/lib/faker/tv_shows/michael_scott.rb +13 -0
- data/lib/faker/tv_shows/new_girl.rb +19 -0
- data/lib/faker/tv_shows/parks_and_rec.rb +18 -0
- data/lib/faker/tv_shows/rick_and_morty.rb +28 -0
- data/lib/faker/tv_shows/ru_paul.rb +18 -0
- data/lib/faker/tv_shows/seinfeld.rb +28 -0
- data/lib/faker/tv_shows/silicon_valley.rb +75 -0
- data/lib/faker/tv_shows/simpsons.rb +28 -0
- data/lib/faker/tv_shows/south_park.rb +19 -0
- data/lib/faker/tv_shows/star_trek.rb +36 -0
- data/lib/faker/tv_shows/stargate.rb +28 -0
- data/lib/faker/tv_shows/stranger_things.rb +19 -0
- data/lib/faker/tv_shows/the_expanse.rb +36 -0
- data/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb +28 -0
- data/lib/faker/tv_shows/the_it_crowd.rb +37 -0
- data/lib/faker/tv_shows/the_thick_of_it.rb +28 -0
- data/lib/faker/tv_shows/twin_peaks.rb +28 -0
- data/lib/faker/tv_shows/venture_bros.rb +38 -0
- data/lib/faker/version.rb +1 -1
- data/lib/locales/en-CA.yml +1 -0
- data/lib/locales/en-TH.yml +360 -0
- data/lib/locales/en/color.yml +1 -1
- data/lib/locales/en/dr_who.yml +1 -1
- data/lib/locales/en/science.yml +1 -1
- data/lib/locales/en/super_smash_bros.yml +1 -0
- data/lib/locales/fr-CA.yml +1 -1
- data/lib/locales/ja.yml +11 -8
- data/lib/locales/th.yml +380 -0
- metadata +26 -17
data/lib/faker/default/device.rb
CHANGED
@@ -3,26 +3,80 @@
|
|
3
3
|
module Faker
|
4
4
|
class Device < Base
|
5
5
|
class << self
|
6
|
+
##
|
7
|
+
# Produces a build number between 1 and 500.
|
8
|
+
#
|
9
|
+
# @return [Integer]
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# Faker::Device.build_number #=> 5
|
13
|
+
#
|
14
|
+
# @faker.version 1.9.0
|
6
15
|
def build_number
|
7
16
|
Faker::Number.between(from: 1, to: 500)
|
8
17
|
end
|
9
18
|
|
19
|
+
##
|
20
|
+
# Produces the name of a manufacturer for a device.
|
21
|
+
#
|
22
|
+
# @return [String]
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Faker::Device.manufacturer #=> "Apple"
|
26
|
+
#
|
27
|
+
# @faker.version 1.9.0
|
10
28
|
def manufacturer
|
11
29
|
fetch('device.manufacturer')
|
12
30
|
end
|
13
31
|
|
32
|
+
##
|
33
|
+
# Produces a model name for a device.
|
34
|
+
#
|
35
|
+
# @return [String]
|
36
|
+
#
|
37
|
+
# @example
|
38
|
+
# Faker::Device.model_name #=> "iPhone 4"
|
39
|
+
#
|
40
|
+
# @faker.version 1.9.0
|
14
41
|
def model_name
|
15
42
|
fetch('device.model_name')
|
16
43
|
end
|
17
44
|
|
45
|
+
##
|
46
|
+
# Produces the name of a platform for a device.
|
47
|
+
#
|
48
|
+
# @return [String]
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
# Faker::Device.platform #=> "webOS"
|
52
|
+
#
|
53
|
+
# @faker.version 1.9.0
|
18
54
|
def platform
|
19
55
|
fetch('device.platform')
|
20
56
|
end
|
21
57
|
|
58
|
+
##
|
59
|
+
# Produces a serial code for a device.
|
60
|
+
#
|
61
|
+
# @return [String]
|
62
|
+
#
|
63
|
+
# @example
|
64
|
+
# Faker::Device.serial #=> "ejfjnRNInxh0363JC2WM"
|
65
|
+
#
|
66
|
+
# @faker.version 1.9.0
|
22
67
|
def serial
|
23
68
|
fetch('device.serial')
|
24
69
|
end
|
25
70
|
|
71
|
+
##
|
72
|
+
# Produces a version number between 1 and 1000.
|
73
|
+
#
|
74
|
+
# @return [Integer]
|
75
|
+
#
|
76
|
+
# @example
|
77
|
+
# Faker::Device.version #=> 42
|
78
|
+
#
|
79
|
+
# @faker.version 1.9.0
|
26
80
|
def version
|
27
81
|
Faker::Number.between(from: 1, to: 1000)
|
28
82
|
end
|
@@ -52,9 +52,9 @@ module Faker
|
|
52
52
|
year = dob.year % 10
|
53
53
|
month = gender == :female ? dob.month + 50 : dob.month
|
54
54
|
# Rubocop's preferred formatting is pretty gory
|
55
|
-
# rubocop:disable FormatString
|
55
|
+
# rubocop:disable Style/FormatString
|
56
56
|
"#{decade}#{'%02d' % month}#{'%02d' % dob.day}#{year}"
|
57
|
-
# rubocop:enable FormatString
|
57
|
+
# rubocop:enable Style/FormatString
|
58
58
|
end
|
59
59
|
|
60
60
|
def gb_licence_checksum
|
@@ -5,14 +5,41 @@ module Faker
|
|
5
5
|
flexible :electrical_components
|
6
6
|
|
7
7
|
class << self
|
8
|
+
##
|
9
|
+
# Produces an active electrical component.
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Faker::ElectricalComponents.active #=> "Transistor"
|
15
|
+
#
|
16
|
+
# @faker.version 1.9.0
|
8
17
|
def active
|
9
18
|
fetch('electrical_components.active')
|
10
19
|
end
|
11
20
|
|
21
|
+
##
|
22
|
+
# Produces a passive electrical component.
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# Faker::ElectricalComponents.passive #=> "Resistor"
|
28
|
+
#
|
29
|
+
# @faker.version 1.9.0
|
12
30
|
def passive
|
13
31
|
fetch('electrical_components.passive')
|
14
32
|
end
|
15
33
|
|
34
|
+
##
|
35
|
+
# Produces an electromechanical electrical component.
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# Faker::ElectricalComponents.electromechanical #=> "Toggle Switch"
|
41
|
+
#
|
42
|
+
# @faker.version 1.9.0
|
16
43
|
def electromechanical
|
17
44
|
fetch('electrical_components.electromechanical')
|
18
45
|
end
|
@@ -3,10 +3,28 @@
|
|
3
3
|
module Faker
|
4
4
|
class GreekPhilosophers < Base
|
5
5
|
class << self
|
6
|
+
##
|
7
|
+
# Produces the name of a Greek philosopher.
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# Faker::GreekPhilosophers.name #=> "Socrates"
|
13
|
+
#
|
14
|
+
# @faker.version 1.9.0
|
6
15
|
def name
|
7
16
|
fetch('greek_philosophers.names')
|
8
17
|
end
|
9
18
|
|
19
|
+
##
|
20
|
+
# Produces a quote from a Greek philosopher.
|
21
|
+
#
|
22
|
+
# @return [String]
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Faker::GreekPhilosophers.quote #=> "Only the educated are free."
|
26
|
+
#
|
27
|
+
# @faker.version 1.9.0
|
10
28
|
def quote
|
11
29
|
fetch('greek_philosophers.quotes')
|
12
30
|
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
|
@@ -5,18 +5,54 @@ module Faker
|
|
5
5
|
flexible :industry_segments
|
6
6
|
|
7
7
|
class << self
|
8
|
+
##
|
9
|
+
# Produces the name of an industry.
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Faker::IndustrySegments.industry #=> "Basic Materials"
|
15
|
+
#
|
16
|
+
# @faker.version 1.9.2
|
8
17
|
def industry
|
9
18
|
fetch('industry_segments.industry')
|
10
19
|
end
|
11
20
|
|
21
|
+
##
|
22
|
+
# Produces the name of a super-sector of an industry.
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# Faker::IndustrySegments.super_sector #=> "Basic Resources"
|
28
|
+
#
|
29
|
+
# @faker.version 1.9.2
|
12
30
|
def super_sector
|
13
31
|
fetch('industry_segments.super_sector')
|
14
32
|
end
|
15
33
|
|
34
|
+
##
|
35
|
+
# Produces the name of a sector of an industry.
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# Faker::IndustrySegments.sector #=> "Industrial Metals & Mining"
|
41
|
+
#
|
42
|
+
# @faker.version 1.9.2
|
16
43
|
def sector
|
17
44
|
fetch('industry_segments.sector')
|
18
45
|
end
|
19
46
|
|
47
|
+
##
|
48
|
+
# Produces the name of a subsector of an industry.
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
# Faker::IndustrySegments.industry #=> "Basic Materials"
|
54
|
+
#
|
55
|
+
# @faker.version 1.9.2
|
20
56
|
def sub_sector
|
21
57
|
fetch('industry_segments.sub_sector')
|
22
58
|
end
|
@@ -73,6 +73,8 @@ module Faker
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
+
# rubocop:disable Metrics/ParameterLists
|
77
|
+
|
76
78
|
##
|
77
79
|
# Produces a randomized string of characters suitable for passwords
|
78
80
|
#
|
@@ -95,8 +97,8 @@ module Faker
|
|
95
97
|
# Faker::Internet.password(min_length: 10, max_length: 20, mix_case: true, special_characters: true) #=> "*%NkOnJsH4"
|
96
98
|
#
|
97
99
|
# @faker.version 2.1.3
|
98
|
-
# rubocop:disable Metrics/ParameterLists
|
99
100
|
def password(legacy_min_length = NOT_GIVEN, legacy_max_length = NOT_GIVEN, legacy_mix_case = NOT_GIVEN, legacy_special_characters = NOT_GIVEN, min_length: 8, max_length: 16, mix_case: true, special_characters: false)
|
101
|
+
# rubocop:enable Metrics/ParameterLists
|
100
102
|
warn_for_deprecated_arguments do |keywords|
|
101
103
|
keywords << :min_length if legacy_min_length != NOT_GIVEN
|
102
104
|
keywords << :max_length if legacy_max_length != NOT_GIVEN
|
@@ -239,6 +241,7 @@ module Faker
|
|
239
241
|
"#{ip_v6_address}/#{rand(1..127)}"
|
240
242
|
end
|
241
243
|
|
244
|
+
# rubocop:disable Metrics/ParameterLists
|
242
245
|
def url(legacy_host = NOT_GIVEN, legacy_path = NOT_GIVEN, legacy_scheme = NOT_GIVEN, host: domain_name, path: "/#{username}", scheme: 'http')
|
243
246
|
# rubocop:enable Metrics/ParameterLists
|
244
247
|
warn_for_deprecated_arguments do |keywords|
|
@@ -5,6 +5,15 @@ module Faker
|
|
5
5
|
flexible :marketing
|
6
6
|
|
7
7
|
class << self
|
8
|
+
##
|
9
|
+
# Produces the name of a video game console or platform.
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Faker::Marketing.buzzwords #=> "rubber meets the road"
|
15
|
+
#
|
16
|
+
# @faker.version 1.9.4
|
8
17
|
def buzzwords
|
9
18
|
fetch('marketing.buzzwords')
|
10
19
|
end
|
@@ -3,22 +3,67 @@
|
|
3
3
|
module Faker
|
4
4
|
class Military < Base
|
5
5
|
class << self
|
6
|
+
##
|
7
|
+
# Produces a rank in the U.S. Army.
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# Faker::Military.army_rank #=> "Staff Sergeant"
|
13
|
+
#
|
14
|
+
# @faker.version 1.9.0
|
6
15
|
def army_rank
|
7
16
|
fetch('military.army_rank')
|
8
17
|
end
|
9
18
|
|
19
|
+
##
|
20
|
+
# Produces a rank in the U.S. Marines.
|
21
|
+
#
|
22
|
+
# @return [String]
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Faker::Military.marines_rank #=> "Gunnery Sergeant"
|
26
|
+
#
|
27
|
+
# @faker.version 1.9.0
|
10
28
|
def marines_rank
|
11
29
|
fetch('military.marines_rank')
|
12
30
|
end
|
13
31
|
|
32
|
+
##
|
33
|
+
# Produces a rank in the U.S. Navy.
|
34
|
+
#
|
35
|
+
# @return [String]
|
36
|
+
#
|
37
|
+
# @example
|
38
|
+
# Faker::Military.navy_rank #=> "Seaman"
|
39
|
+
#
|
40
|
+
# @faker.version 1.9.0
|
14
41
|
def navy_rank
|
15
42
|
fetch('military.navy_rank')
|
16
43
|
end
|
17
44
|
|
45
|
+
##
|
46
|
+
# Produces a rank in the U.S. Air Force.
|
47
|
+
#
|
48
|
+
# @return [String]
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
# Faker::Military.air_force_rank #=> "Captain"
|
52
|
+
#
|
53
|
+
# @faker.version 1.9.0
|
18
54
|
def air_force_rank
|
19
55
|
fetch('military.air_force_rank')
|
20
56
|
end
|
21
57
|
|
58
|
+
##
|
59
|
+
# Produces a U.S. Department of Defense Paygrade.
|
60
|
+
#
|
61
|
+
# @return [String]
|
62
|
+
#
|
63
|
+
# @example
|
64
|
+
# Faker::Military.dod_paygrade #=> "E-6"
|
65
|
+
#
|
66
|
+
# @faker.version 1.9.0
|
22
67
|
def dod_paygrade
|
23
68
|
fetch('military.dod_paygrade')
|
24
69
|
end
|
data/lib/faker/default/nation.rb
CHANGED
@@ -4,27 +4,70 @@ module Faker
|
|
4
4
|
class Nation < Base
|
5
5
|
flexible :nation
|
6
6
|
class << self
|
7
|
-
|
7
|
+
##
|
8
|
+
# Produces a random nationality.
|
9
|
+
#
|
10
|
+
# @return [String]
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# Faker::Nation.nationality #=> "Nepalese"
|
14
|
+
#
|
15
|
+
# @faker.version 1.9.0
|
8
16
|
def nationality
|
9
17
|
fetch('nation.nationality')
|
10
18
|
end
|
11
19
|
|
12
|
-
#
|
20
|
+
# rubocop:disable Style/AsciiComments
|
21
|
+
|
22
|
+
##
|
23
|
+
# Produces a random national flag emoji.
|
24
|
+
#
|
25
|
+
# @return [String]
|
26
|
+
#
|
27
|
+
# @example
|
28
|
+
# Faker::Nation.flag #=> "🇫🇮"
|
29
|
+
#
|
30
|
+
# @faker.version 1.9.0
|
13
31
|
def flag
|
14
32
|
sample(translate('faker.nation.flag')).pack('C*').force_encoding('utf-8')
|
15
33
|
end
|
34
|
+
# rubocop:enable Style/AsciiComments
|
16
35
|
|
17
|
-
|
36
|
+
##
|
37
|
+
# Produces a random national language.
|
38
|
+
#
|
39
|
+
# @return [String]
|
40
|
+
#
|
41
|
+
# @example
|
42
|
+
# Faker::Nation.language #=> "Nepali"
|
43
|
+
#
|
44
|
+
# @faker.version 1.9.0
|
18
45
|
def language
|
19
46
|
fetch('nation.language')
|
20
47
|
end
|
21
48
|
|
22
|
-
|
49
|
+
##
|
50
|
+
# Produces a random capital city.
|
51
|
+
#
|
52
|
+
# @return [String]
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
# Faker::Nation.capital_city #=> "Kathmandu"
|
56
|
+
#
|
57
|
+
# @faker.version 1.9.0
|
23
58
|
def capital_city
|
24
59
|
fetch('nation.capital_city')
|
25
60
|
end
|
26
61
|
|
27
|
-
|
62
|
+
##
|
63
|
+
# Produces a random national sport.
|
64
|
+
#
|
65
|
+
# @return [String]
|
66
|
+
#
|
67
|
+
# @example
|
68
|
+
# Faker::Nation.national_sport #=> "dandi biyo"
|
69
|
+
#
|
70
|
+
# @faker.version 1.9.0
|
28
71
|
def national_sport
|
29
72
|
fetch('team.sport')
|
30
73
|
end
|