faker 2.3.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +118 -2
  3. data/README.md +5 -1
  4. data/lib/faker/blockchain/aeternity.rb +70 -0
  5. data/lib/faker/default/app.rb +2 -1
  6. data/lib/faker/default/appliance.rb +18 -0
  7. data/lib/faker/default/avatar.rb +2 -1
  8. data/lib/faker/default/chuck_norris.rb +1 -1
  9. data/lib/faker/default/date.rb +83 -2
  10. data/lib/faker/default/dessert.rb +27 -0
  11. data/lib/faker/default/device.rb +54 -0
  12. data/lib/faker/default/driving_licence.rb +2 -2
  13. data/lib/faker/default/electrical_components.rb +27 -0
  14. data/lib/faker/default/greek_philosophers.rb +18 -0
  15. data/lib/faker/default/id_number.rb +29 -0
  16. data/lib/faker/default/industry_segments.rb +36 -0
  17. data/lib/faker/default/internet.rb +4 -1
  18. data/lib/faker/default/marketing.rb +9 -0
  19. data/lib/faker/default/military.rb +45 -0
  20. data/lib/faker/default/nation.rb +48 -5
  21. data/lib/faker/default/nato_phonetic_alphabet.rb +9 -0
  22. data/lib/faker/default/number.rb +124 -0
  23. data/lib/faker/default/restaurant.rb +54 -2
  24. data/lib/faker/default/science.rb +27 -0
  25. data/lib/faker/default/subscription.rb +45 -0
  26. data/lib/faker/default/superhero.rb +45 -0
  27. data/lib/faker/default/time.rb +85 -8
  28. data/lib/faker/default/world_cup.rb +50 -0
  29. data/lib/faker/games/dota.rb +47 -0
  30. data/lib/faker/games/heroes.rb +27 -0
  31. data/lib/faker/games/heroes_of_the_storm.rb +36 -0
  32. data/lib/faker/games/league_of_legends.rb +54 -0
  33. data/lib/faker/games/myst.rb +45 -0
  34. data/lib/faker/games/pokemon.rb +27 -0
  35. data/lib/faker/games/sonic_the_hedgehog.rb +27 -0
  36. data/lib/faker/games/witcher.rb +54 -0
  37. data/lib/faker/games/world_of_warcraft.rb +18 -0
  38. data/lib/faker/games/zelda.rb +1 -1
  39. data/lib/faker/japanese_media/dragon_ball.rb +9 -0
  40. data/lib/faker/japanese_media/one_piece.rb +54 -0
  41. data/lib/faker/japanese_media/sword_art_online.rb +36 -0
  42. data/lib/faker/movies/back_to_the_future.rb +28 -0
  43. data/lib/faker/movies/ghostbusters.rb +28 -0
  44. data/lib/faker/movies/harry_potter.rb +54 -0
  45. data/lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb +69 -0
  46. data/lib/faker/movies/hobbit.rb +37 -0
  47. data/lib/faker/movies/lebowski.rb +27 -0
  48. data/lib/faker/movies/lord_of_the_rings.rb +28 -0
  49. data/lib/faker/movies/movie.rb +9 -0
  50. data/lib/faker/movies/princess_bride.rb +19 -0
  51. data/lib/faker/movies/star_wars.rb +94 -0
  52. data/lib/faker/movies/v_for_vendetta.rb +29 -0
  53. data/lib/faker/music/grateful_dead.rb +18 -0
  54. data/lib/faker/music/phish.rb +9 -0
  55. data/lib/faker/music/rock_band.rb +9 -0
  56. data/lib/faker/music/umphreys_mcgee.rb +9 -0
  57. data/lib/faker/sports/basketball.rb +36 -0
  58. data/lib/faker/sports/football.rb +45 -0
  59. data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +9 -0
  60. data/lib/faker/tv_shows/bojack_horseman.rb +28 -0
  61. data/lib/faker/tv_shows/buffy.rb +45 -0
  62. data/lib/faker/tv_shows/community.rb +19 -0
  63. data/lib/faker/tv_shows/dr_who.rb +78 -2
  64. data/lib/faker/tv_shows/dumb_and_dumber.rb +28 -0
  65. data/lib/faker/tv_shows/family_guy.rb +28 -0
  66. data/lib/faker/tv_shows/friends.rb +27 -0
  67. data/lib/faker/tv_shows/game_of_thrones.rb +46 -0
  68. data/lib/faker/tv_shows/hey_arnold.rb +27 -0
  69. data/lib/faker/tv_shows/how_i_met_your_mother.rb +37 -0
  70. data/lib/faker/tv_shows/michael_scott.rb +13 -0
  71. data/lib/faker/tv_shows/new_girl.rb +19 -0
  72. data/lib/faker/tv_shows/parks_and_rec.rb +18 -0
  73. data/lib/faker/tv_shows/rick_and_morty.rb +28 -0
  74. data/lib/faker/tv_shows/ru_paul.rb +18 -0
  75. data/lib/faker/tv_shows/seinfeld.rb +28 -0
  76. data/lib/faker/tv_shows/silicon_valley.rb +75 -0
  77. data/lib/faker/tv_shows/simpsons.rb +28 -0
  78. data/lib/faker/tv_shows/south_park.rb +19 -0
  79. data/lib/faker/tv_shows/star_trek.rb +36 -0
  80. data/lib/faker/tv_shows/stargate.rb +28 -0
  81. data/lib/faker/tv_shows/stranger_things.rb +19 -0
  82. data/lib/faker/tv_shows/the_expanse.rb +36 -0
  83. data/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb +28 -0
  84. data/lib/faker/tv_shows/the_it_crowd.rb +37 -0
  85. data/lib/faker/tv_shows/the_thick_of_it.rb +28 -0
  86. data/lib/faker/tv_shows/twin_peaks.rb +28 -0
  87. data/lib/faker/tv_shows/venture_bros.rb +38 -0
  88. data/lib/faker/version.rb +1 -1
  89. data/lib/locales/en-CA.yml +1 -0
  90. data/lib/locales/en-TH.yml +360 -0
  91. data/lib/locales/en/color.yml +1 -1
  92. data/lib/locales/en/dr_who.yml +1 -1
  93. data/lib/locales/en/science.yml +1 -1
  94. data/lib/locales/en/super_smash_bros.yml +1 -0
  95. data/lib/locales/fr-CA.yml +1 -1
  96. data/lib/locales/ja.yml +11 -8
  97. data/lib/locales/th.yml +380 -0
  98. metadata +26 -17
@@ -3,6 +3,15 @@
3
3
  module Faker
4
4
  class NatoPhoneticAlphabet < Base
5
5
  class << self
6
+ ##
7
+ # Produces a code word from the NATO phonetic alphabet.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::NatoPhoneticAlphabet.code_word #=> "Hotel"
13
+ #
14
+ # @faker.version 1.9.0
6
15
  def code_word
7
16
  fetch('nato_phonetic_alphabet.code_word')
8
17
  end
@@ -3,6 +3,16 @@
3
3
  module Faker
4
4
  class Number < Base
5
5
  class << self
6
+ ##
7
+ # Produce a random number.
8
+ #
9
+ # @param digits [Integer] Number of digits that the generated number should have.
10
+ # @return [Integer]
11
+ #
12
+ # @example
13
+ # Faker::Number.number(digits: 10) #=> 1968353479
14
+ #
15
+ # @faker.version 1.0.0
6
16
  def number(legacy_digits = NOT_GIVEN, digits: 10)
7
17
  warn_for_deprecated_arguments do |keywords|
8
18
  keywords << :digits if legacy_digits != NOT_GIVEN
@@ -15,6 +25,16 @@ module Faker
15
25
  ([non_zero_digit] + generate(digits - 1)).join.to_i
16
26
  end
17
27
 
28
+ ##
29
+ # Produce a random number with a leading zero.
30
+ #
31
+ # @param digits [Integer] Number of digits that the generated number should have.
32
+ # @return [String]
33
+ #
34
+ # @example
35
+ # Faker::Number.leading_zero_number(digits: 10) #=> "0669336915"
36
+ #
37
+ # @faker.version 1.0.0
18
38
  def leading_zero_number(legacy_digits = NOT_GIVEN, digits: 10)
19
39
  warn_for_deprecated_arguments do |keywords|
20
40
  keywords << :digits if legacy_digits != NOT_GIVEN
@@ -23,6 +43,16 @@ module Faker
23
43
  '0' + (2..digits).collect { digit }.join
24
44
  end
25
45
 
46
+ ##
47
+ # Produce a number with a number of digits, preserves leading zeroes.
48
+ #
49
+ # @param digits [Integer] Number of digits that the generated number should have.
50
+ # @return [String]
51
+ #
52
+ # @example
53
+ # Faker::Number.decimal_part(digits: 2) #=> "09"
54
+ #
55
+ # @faker.version 1.0.0
26
56
  def decimal_part(legacy_digits = NOT_GIVEN, digits: 10)
27
57
  warn_for_deprecated_arguments do |keywords|
28
58
  keywords << :digits if legacy_digits != NOT_GIVEN
@@ -36,6 +66,18 @@ module Faker
36
66
  leading_zero_number(digits: digits) + num.to_s
37
67
  end
38
68
 
69
+ ##
70
+ # Produces a float.
71
+ #
72
+ # @param l_digits [Integer] Number of digits that the generated decimal should have to the left of the decimal point.
73
+ # @param r_digits [Integer] Number of digits that the generated decimal should have to the right of the decimal point.
74
+ # @return [Float]
75
+ #
76
+ # @example
77
+ # Faker::Number.decimal(l_digits: 2) #=> 11.88
78
+ # Faker::Number.decimal(l_digits: 3, r_digits: 3) #=> 181.843
79
+ #
80
+ # @faker.version 1.0.0
39
81
  def decimal(legacy_l_digits = NOT_GIVEN, legacy_r_digits = NOT_GIVEN, l_digits: 5, r_digits: 2)
40
82
  warn_for_deprecated_arguments do |keywords|
41
83
  keywords << :l_digits if legacy_l_digits != NOT_GIVEN
@@ -53,14 +95,42 @@ module Faker
53
95
  "#{l_d}.#{r_d}".to_f
54
96
  end
55
97
 
98
+ ##
99
+ # Produces a non-zero single-digit integer.
100
+ #
101
+ # @return [Integer]
102
+ #
103
+ # @example
104
+ # Faker::Number.non_zero_digit #=> 8
105
+ #
106
+ # @faker.version 1.0.0
56
107
  def non_zero_digit
57
108
  rand(1..9)
58
109
  end
59
110
 
111
+ ##
112
+ # Produces a single-digit integer.
113
+ #
114
+ # @return [Integer]
115
+ #
116
+ # @example
117
+ # Faker::Number.digit #=> 1
118
+ #
119
+ # @faker.version 1.0.0
60
120
  def digit
61
121
  rand(10)
62
122
  end
63
123
 
124
+ ##
125
+ # Produces a number in hexadecimal format.
126
+ #
127
+ # @param digits [Integer] Number of digits in the he
128
+ # @return [String]
129
+ #
130
+ # @example
131
+ # Faker::Number.hexadecimal(digits: 3) #=> "e74"
132
+ #
133
+ # @faker.version 1.0.0
64
134
  def hexadecimal(legacy_digits = NOT_GIVEN, digits: 6)
65
135
  warn_for_deprecated_arguments do |keywords|
66
136
  keywords << :digits if legacy_digits != NOT_GIVEN
@@ -71,6 +141,17 @@ module Faker
71
141
  hex
72
142
  end
73
143
 
144
+ ##
145
+ # Produces a float given a mean and standard deviation.
146
+ #
147
+ # @param mean [Integer]
148
+ # @param standard_deviation [Integer, Float]
149
+ # @return [Float]
150
+ #
151
+ # @example
152
+ # Faker::Number.normal(mean: 50, standard_deviation: 3.5) #=> 47.14669604069156
153
+ #
154
+ # @faker.version 1.0.0
74
155
  def normal(legacy_mean = NOT_GIVEN, legacy_standard_deviation = NOT_GIVEN, mean: 1, standard_deviation: 1)
75
156
  warn_for_deprecated_arguments do |keywords|
76
157
  keywords << :mean if legacy_mean != NOT_GIVEN
@@ -83,6 +164,17 @@ module Faker
83
164
  mean + scale * Math.cos(theta)
84
165
  end
85
166
 
167
+ ##
168
+ # Produces a number between two provided values. Boundaries are inclusive.
169
+ #
170
+ # @param from [Integer] The lowest number to include.
171
+ # @param to [Integer] The highest number to include.
172
+ # @return [Integer]
173
+ #
174
+ # @example
175
+ # Faker::Number.between(from: 1, to: 10) #=> 7
176
+ #
177
+ # @faker.version 1.0.0
86
178
  def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 1.00, to: 5000.00)
87
179
  warn_for_deprecated_arguments do |keywords|
88
180
  keywords << :from if legacy_from != NOT_GIVEN
@@ -92,6 +184,16 @@ module Faker
92
184
  Faker::Base.rand_in_range(from, to)
93
185
  end
94
186
 
187
+ ##
188
+ # Produces a number within two provided values. Boundaries are inclusive or exclusive depending on the range passed.
189
+ #
190
+ # @param range [Range] The range from which to generate a number.
191
+ # @return [Integer]
192
+ #
193
+ # @example
194
+ # Faker::Number.within(range: 1..10) #=> 7
195
+ #
196
+ # @faker.version 1.0.0
95
197
  def within(legacy_range = NOT_GIVEN, range: 1.00..5000.00)
96
198
  warn_for_deprecated_arguments do |keywords|
97
199
  keywords << :range if legacy_range != NOT_GIVEN
@@ -100,6 +202,17 @@ module Faker
100
202
  between(from: range.min, to: range.max)
101
203
  end
102
204
 
205
+ ##
206
+ # Produces a positive float.
207
+ #
208
+ # @param from [Integer] The lower boundary.
209
+ # @param to [Integer] The higher boundary.
210
+ # @return [Float]
211
+ #
212
+ # @example
213
+ # Faker::Number.positive #=> 235.59238499107653
214
+ #
215
+ # @faker.version 1.0.0
103
216
  def positive(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 1.00, to: 5000.00)
104
217
  warn_for_deprecated_arguments do |keywords|
105
218
  keywords << :from if legacy_from != NOT_GIVEN
@@ -111,6 +224,17 @@ module Faker
111
224
  greater_than_zero(random_number)
112
225
  end
113
226
 
227
+ ##
228
+ # Produces a negative float.
229
+ #
230
+ # @param from [Integer] The lower boundary.
231
+ # @param to [Integer] The higher boundary.
232
+ # @return [Float]
233
+ #
234
+ # @example
235
+ # Faker::Number.negative #=> -4480.042585669558
236
+ #
237
+ # @faker.version 1.0.0
114
238
  def negative(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: -5000.00, to: -1.00)
115
239
  warn_for_deprecated_arguments do |keywords|
116
240
  keywords << :from if legacy_from != NOT_GIVEN
@@ -4,8 +4,60 @@ module Faker
4
4
  class Restaurant < Base
5
5
  flexible :restaurant
6
6
 
7
- def self.name
8
- bothify(parse('restaurant.name'))
7
+ class << self
8
+ ##
9
+ # Produces the name of a restaurant.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Restaurant.name #=> "Curry King"
15
+ #
16
+ # @faker.version 1.9.2
17
+ def name
18
+ bothify(parse('restaurant.name'))
19
+ end
20
+
21
+ ##
22
+ # Produces a type of restaurant.
23
+ #
24
+ # @return [String]
25
+ #
26
+ # @example
27
+ # Faker::Restaurant.type #=> "Comfort Food"
28
+ #
29
+ # @faker.version 1.9.2
30
+ def type
31
+ fetch('restaurant.type')
32
+ end
33
+
34
+ ##
35
+ # Produces a description of a restaurant.
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example
40
+ # Faker::Restaurant.description
41
+ # #=> "We are committed to using the finest ingredients in our recipes. No food leaves our kitchen that we ourselves would not eat."
42
+ #
43
+ # @faker.version 1.9.2
44
+ def description
45
+ fetch('restaurant.description')
46
+ end
47
+
48
+ ##
49
+ # Produces a review for a restaurant.
50
+ #
51
+ # @return [String]
52
+ #
53
+ # @example
54
+ # Faker::Restaurant.review
55
+ # #=> "Brand new. Great design. Odd to hear pop music in a Mexican establishment. Music is a bit loud. It should be background."
56
+ #
57
+ # @faker.version 1.9.2
58
+ def review
59
+ fetch('restaurant.review')
60
+ end
9
61
  end
10
62
  end
11
63
  end
@@ -3,14 +3,41 @@
3
3
  module Faker
4
4
  class Science < Base
5
5
  class << self
6
+ ##
7
+ # Produces the name of a element.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::Science.element #=> "Carbon"
13
+ #
14
+ # @faker.version 1.8.5
6
15
  def element
7
16
  fetch('science.element')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces the symbol of an element.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::Science.element_symbol #=> "Pb"
26
+ #
27
+ # @faker.version 1.9.0
10
28
  def element_symbol
11
29
  fetch('science.element_symbol')
12
30
  end
13
31
 
32
+ ##
33
+ # Produces the name of a scientist.
34
+ #
35
+ # @return [String]
36
+ #
37
+ # @example
38
+ # Faker::Science.scientist #=> "Isaac Newton"
39
+ #
40
+ # @faker.version 1.8.5
14
41
  def scientist
15
42
  fetch('science.scientist')
16
43
  end
@@ -2,22 +2,67 @@
2
2
 
3
3
  module Faker
4
4
  class Subscription < Base
5
+ ##
6
+ # Produces the name of a subscription plan.
7
+ #
8
+ # @return [String]
9
+ #
10
+ # @example
11
+ # Faker::Subscription.plan #=> "Platinum"
12
+ #
13
+ # @faker.version 1.9.2
5
14
  def self.plan
6
15
  fetch('subscription.plans')
7
16
  end
8
17
 
18
+ ##
19
+ # Produces a subscription status.
20
+ #
21
+ # @return [String]
22
+ #
23
+ # @example
24
+ # Faker::Subscription.status #=> "Active"
25
+ #
26
+ # @faker.version 1.9.2
9
27
  def self.status
10
28
  fetch('subscription.statuses')
11
29
  end
12
30
 
31
+ ##
32
+ # Produces the name of a payment method.
33
+ #
34
+ # @return [String]
35
+ #
36
+ # @example
37
+ # Faker::Subscription.payment_method #=> "PayPal"
38
+ #
39
+ # @faker.version 1.9.2
13
40
  def self.payment_method
14
41
  fetch('subscription.payment_methods')
15
42
  end
16
43
 
44
+ ##
45
+ # Produces the name of a subscription term.
46
+ #
47
+ # @return [String]
48
+ #
49
+ # @example
50
+ # Faker::Subscription.subscription_term #=> "Annual"
51
+ #
52
+ # @faker.version 1.9.2
17
53
  def self.subscription_term
18
54
  fetch('subscription.subscription_terms')
19
55
  end
20
56
 
57
+ ##
58
+ # Produces the name of a payment term.
59
+ #
60
+ # @return [String]
61
+ #
62
+ # @example
63
+ # Faker::Subscription.payment_term #=> "Monthly"
64
+ #
65
+ # @faker.version 1.9.2
21
66
  def self.payment_term
22
67
  fetch('subscription.payment_terms')
23
68
  end
@@ -3,22 +3,67 @@
3
3
  module Faker
4
4
  class Superhero < Base
5
5
  class << self
6
+ ##
7
+ # Produces a superpower.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::Superhero.power #=> "Photokinesis"
13
+ #
14
+ # @faker.version 1.6.2
6
15
  def power
7
16
  fetch('superhero.power')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces a superhero name prefix.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::Superhero.prefix #=> "the Fated"
26
+ #
27
+ # @faker.version 1.6.2
10
28
  def prefix
11
29
  fetch('superhero.prefix')
12
30
  end
13
31
 
32
+ ##
33
+ # Produces a superhero name suffix.
34
+ #
35
+ # @return [String]
36
+ #
37
+ # @example
38
+ # Faker::Superhero.suffix #=> "Captain"
39
+ #
40
+ # @faker.version 1.6.2
14
41
  def suffix
15
42
  fetch('superhero.suffix')
16
43
  end
17
44
 
45
+ ##
46
+ # Produces a superhero descriptor.
47
+ #
48
+ # @return [String]
49
+ #
50
+ # @example
51
+ # Faker::Superhero.descriptor #=> "Bizarro"
52
+ #
53
+ # @faker.version 1.6.2
18
54
  def descriptor
19
55
  fetch('superhero.descriptor')
20
56
  end
21
57
 
58
+ ##
59
+ # Produces a random superhero name.
60
+ #
61
+ # @return [String]
62
+ #
63
+ # @example
64
+ # Faker::Superhero.name #=> "Magnificent Shatterstar"
65
+ #
66
+ # @faker.version 1.6.2
22
67
  def name
23
68
  parse('superhero.name')
24
69
  end