faker 3.1.1 → 3.2.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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +64 -1
  3. data/README.md +12 -4
  4. data/lib/faker/default/company.rb +13 -0
  5. data/lib/faker/default/food.rb +13 -0
  6. data/lib/faker/default/internet.rb +52 -22
  7. data/lib/faker/default/marketing.rb +1 -1
  8. data/lib/faker/default/omniauth.rb +1 -1
  9. data/lib/faker/default/twitter.rb +1 -1
  10. data/lib/faker/games/dnd.rb +49 -7
  11. data/lib/faker/movies/avatar.rb +49 -0
  12. data/lib/faker/quotes/quote.rb +13 -0
  13. data/lib/faker/sports/chess.rb +90 -0
  14. data/lib/faker/travel/airport.rb +0 -4
  15. data/lib/faker/version.rb +1 -1
  16. data/lib/faker.rb +0 -1
  17. data/lib/locales/ar.yml +1 -0
  18. data/lib/locales/bg.yml +1 -1
  19. data/lib/locales/da-DK.yml +1 -0
  20. data/lib/locales/de-AT.yml +1 -1
  21. data/lib/locales/de-CH.yml +1 -0
  22. data/lib/locales/de.yml +1 -0
  23. data/lib/locales/en/avatar.yml +31 -0
  24. data/lib/locales/en/chess.yml +103 -0
  25. data/lib/locales/en/company.yml +1 -0
  26. data/lib/locales/en/dnd.yml +186 -1
  27. data/lib/locales/en/food.yml +12 -0
  28. data/lib/locales/en/internet.yml +3 -0
  29. data/lib/locales/en/mitch_hedberg.yml +46 -0
  30. data/lib/locales/en-AU.yml +1 -0
  31. data/lib/locales/en-CA.yml +1 -0
  32. data/lib/locales/en-GB.yml +2 -0
  33. data/lib/locales/en-MS.yml +1 -0
  34. data/lib/locales/en-NG.yml +1 -0
  35. data/lib/locales/en-NZ.yml +1 -0
  36. data/lib/locales/en-PAK.yml +1 -0
  37. data/lib/locales/en-SG.yml +1 -0
  38. data/lib/locales/en-UG.yml +1 -0
  39. data/lib/locales/en-US.yml +1 -0
  40. data/lib/locales/en-ZA.yml +1 -0
  41. data/lib/locales/en-au-ocker.yml +2 -0
  42. data/lib/locales/es-AR.yml +1 -0
  43. data/lib/locales/es-MX.yml +1 -0
  44. data/lib/locales/es.yml +1 -0
  45. data/lib/locales/fi-FI.yml +1 -0
  46. data/lib/locales/fr-CA.yml +1 -0
  47. data/lib/locales/fr-CH.yml +1 -0
  48. data/lib/locales/hy.yml +1 -0
  49. data/lib/locales/it.yml +1 -0
  50. data/lib/locales/ko.yml +1 -0
  51. data/lib/locales/mi-NZ.yml +2 -0
  52. data/lib/locales/nb-NO.yml +1 -0
  53. data/lib/locales/nl.yml +1 -0
  54. data/lib/locales/pl.yml +1 -0
  55. data/lib/locales/pt-BR.yml +1 -0
  56. data/lib/locales/pt.yml +1 -0
  57. data/lib/locales/ru.yml +1 -0
  58. data/lib/locales/sk.yml +1 -0
  59. data/lib/locales/sv.yml +1 -0
  60. data/lib/locales/tr.yml +1 -0
  61. data/lib/locales/uk.yml +1 -0
  62. data/lib/locales/vi.yml +1 -0
  63. data/lib/locales/zh-CN.yml +1 -0
  64. data/lib/locales/zh-TW.yml +1 -0
  65. metadata +15 -11
  66. data/lib/faker/default/fillmurray.rb +0 -38
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8241b18a0078e007934c8130b67a65b2415b4a1a5fd3eafbdf7ca2a8de472df4
4
- data.tar.gz: fd3b7284513b51922902c54ebe2e116966516d0b3aae90360ec9b24aa19c6ebc
3
+ metadata.gz: 96ec3715aa40eae20241ea0235f17234c691cbd808a5a5f523e2600979bc1c18
4
+ data.tar.gz: e57effe991fbdbc74562d35066f8db66f46be5d3d441e7b650c720a072c23a94
5
5
  SHA512:
6
- metadata.gz: 40c65cdbac78acc2333a8f15301ddcf8bd045d1b606fb240c6750b912e05aa8056a31564da1c09a11d4820d79b920e698d3f5a5b00e5460d18062bddca454576
7
- data.tar.gz: 143b9e1727934d68ee9bcd986302574dd701ede88868114744eeec23a8f501ea0774b3f0025c35482733934a8cda1e560abed50c5eb7dddc682e38e34030ce93
6
+ metadata.gz: 9a12b535d55c2e3d5559228f6b9eafd98a383692165670c7a80f4a986d1c3b23637d59faa69fcc2b06142ee2445e88ce4b8057bdf72f71eafd0c86baeb9147ed
7
+ data.tar.gz: 844caa61e4c4be1975f0fc8355302627ff9ead7cf7d423dd78313a4876190482fcb471a95fb43509e0e761d0bac671484851edbaf3cf98325d7864c591b83e6e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,68 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.2.0](https://github.com/faker-ruby/faker/tree/v3.2.0) (2023-04-14)
4
+
5
+ Happy Spring with a new Faker release! 🌼
6
+
7
+ This version changes `Faker::Internet.email`, `Faker::Internet.domain_name`, `Faker::Internet.safe_email`, and `Faker::Internet.free_email` default behavior.
8
+
9
+ These generators email are now RFC 2606 compliant. They generate safe values by default using the Reserved Top Level DNS Names: `example` and `test`. To maintain backwards compatibility and give users the option to use non-safe domains at their own risk, custom domains are allowed.
10
+
11
+ `Faker::Internet.safe_email`, and `Faker::Internet.free_email` have been deprecated. Users have until October 2023 to make the necessary changes.
12
+
13
+ [More details and updated docs can be found here](https://github.com/faker-ruby/faker/blob/main/doc/default/internet.md#about-faker-ruby-transition-to-be-rfc-2606-compliant).
14
+
15
+ Other changes included in this version:
16
+
17
+ ## Features
18
+ * Generate safe `email` and `domain_name` by default (RFC 2606) by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2733
19
+ * Add avatar movie by @lexisvar in https://github.com/faker-ruby/faker/pull/2699
20
+ * add chess sport by @lexisvar in https://github.com/faker-ruby/faker/pull/2701
21
+ * Remove FillMurray service by @ferblape in https://github.com/faker-ruby/faker/pull/2702
22
+ * Add Allergens to Food by @AaronRustad in https://github.com/faker-ruby/faker/pull/2706
23
+ * Update sport docs by @clementf in https://github.com/faker-ruby/faker/pull/2716
24
+ * Add country code +44 to en-gb locale by @jremes-foss in https://github.com/faker-ruby/faker/pull/2731
25
+ * Add names to DnD generator by @dollerbill in https://github.com/faker-ruby/faker/pull/2735
26
+ * add digits to password by @wyattroyc in https://github.com/faker-ruby/faker/pull/2705
27
+ * performance: remove unnecessary i18n locale reload by @codez in https://github.com/faker-ruby/faker/pull/2723
28
+ * Add Faker::Company.department generator by @acuppy in https://github.com/faker-ruby/faker/pull/2737
29
+ * Mitch Hedberg quotes by @MosDeef in https://github.com/faker-ruby/faker/pull/2721
30
+
31
+ ## Bug fixes
32
+ * Fix explanation what Marketing.buzzwords does by @danieldiekmeier in https://github.com/faker-ruby/faker/pull/2700
33
+ * fix: Typo in Faker::Travel::Airport docs by @evanlouden in https://github.com/faker-ruby/faker/pull/2712
34
+ * Fix full changelog link for 3.1.1 by @rnestler in https://github.com/faker-ruby/faker/pull/2714
35
+ * Stop publishing to RubyGem by @VladVadlja in https://github.com/faker-ruby/faker/pull/2711
36
+ * Add default_country_code in locale by @ashwin-elangovan in https://github.com/faker-ruby/faker/pull/2732
37
+ * Fix formatting in readme.md by @leon-vogt in https://github.com/faker-ruby/faker/pull/2722
38
+
39
+ ## Update local dependencies
40
+ * Fix rubocop updates by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2708
41
+ * Update rubocop-minitest requirement from = 0.29.0 to = 0.30.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2743
42
+ * Update minitest requirement from = 5.17.0 to = 5.18.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2727
43
+ * Update rubocop requirement from = 1.48.1 to = 1.50.1 by @dependabot in https://github.com/faker-ruby/faker/pull/2747
44
+ * Add Faker::Company.department generator by @acuppy in https://github.com/faker-ruby/faker/pull/2737
45
+ * Update Pull Request template and guides by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2749
46
+
47
+ ## New Contributors
48
+ * @lexisvar made their first contribution in https://github.com/faker-ruby/faker/pull/2699
49
+ * @danieldiekmeier made their first contribution in https://github.com/faker-ruby/faker/pull/2700
50
+ * @AaronRustad made their first contribution in https://github.com/faker-ruby/faker/pull/2706
51
+ * @evanlouden made their first contribution in https://github.com/faker-ruby/faker/pull/2712
52
+ * @rnestler made their first contribution in https://github.com/faker-ruby/faker/pull/2714
53
+ * @VladVadlja made their first contribution in https://github.com/faker-ruby/faker/pull/2711
54
+ * @clementf made their first contribution in https://github.com/faker-ruby/faker/pull/2716
55
+ * @leon-vogt made their first contribution in https://github.com/faker-ruby/faker/pull/2722
56
+ * @ashwin-elangovan made their first contribution in https://github.com/faker-ruby/faker/pull/2732
57
+ * @wyattroyc made their first contribution in https://github.com/faker-ruby/faker/pull/2705
58
+ * @codez made their first contribution in https://github.com/faker-ruby/faker/pull/2723
59
+ * @acuppy made their first contribution in https://github.com/faker-ruby/faker/pull/2737
60
+ * @MosDeef made their first contribution in https://github.com/faker-ruby/faker/pull/2721
61
+
62
+ **Full Changelog**: https://github.com/faker-ruby/faker/compare/v3.1.1...v3.2.0
63
+
64
+ ------------------------------------------------------------------------------
65
+
3
66
  ## [v3.1.1](https://github.com/faker-ruby/faker/tree/v3.1.1) (2023-02-03)
4
67
 
5
68
  Happy Valentine's Day with a new Faker release! 🎉
@@ -35,7 +98,7 @@ This version:
35
98
  * @petergoldstein made their first contribution in https://github.com/faker-ruby/faker/pull/2673
36
99
  * @dwilsonactual made their first contribution in https://github.com/faker-ruby/faker/pull/2693
37
100
 
38
- **Full Changelog**: https://github.com/faker-ruby/faker/compare/v3.1.0...v.3.1.1
101
+ **Full Changelog**: https://github.com/faker-ruby/faker/compare/v3.1.0...v3.1.1
39
102
 
40
103
  ------------------------------------------------------------------------------
41
104
 
data/README.md CHANGED
@@ -27,12 +27,16 @@ and it was the original impetus for the creation of this gem).
27
27
  ## Table of Contents
28
28
 
29
29
  - [Faker](#faker)
30
+ - [Quick links](#quick-links)
31
+ - [Table of Contents](#table-of-contents)
30
32
  - [Notes](#notes)
31
33
  - [Getting Started](#getting-started)
32
34
  - [Usage](#usage)
35
+ - [A note about the Generators versions](#a-note-about-the-generators-versions)
33
36
  - [Ensuring unique values](#ensuring-unique-values)
34
37
  - [Deterministic Random](#deterministic-random)
35
38
  - [Customization](#customization)
39
+ - [Minitest and Faker \>= 2.22](#minitest-and-faker--222)
36
40
  - [Generators](#generators)
37
41
  - [Contributing](#contributing)
38
42
  - [Versioning](#versioning)
@@ -167,7 +171,7 @@ Faker::Config.locale = :es
167
171
 
168
172
  Note: Overriding the default locale might not be thread-safe. See [Locale setting can be ignored #2563](https://github.com/faker-ruby/faker/issues/2563) for more details.
169
173
 
170
- To override Faker's locales,
174
+ To override Faker's locales,
171
175
  check out the [locales README](lib/locales/README.md).
172
176
 
173
177
  ### Minitest and Faker >= 2.22
@@ -237,7 +241,6 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
237
241
  - [Faker::Emotion](doc/default/emotion.md)
238
242
  - [Faker::Esport](doc/default/esport.md)
239
243
  - [Faker::File](doc/default/file.md)
240
- - [Faker::Fillmurray](doc/default/fillmurray.md)
241
244
  - [Faker::Finance](doc/default/finance.md)
242
245
  - [Faker::Food](doc/default/food.md)
243
246
  - [Faker::FunnyName](doc/default/funny_name.md)
@@ -319,10 +322,13 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
319
322
  </details>
320
323
 
321
324
  <details>
322
- <summary>Creature</summary>
325
+ <summary>Travel</summary>
323
326
 
324
- ### Travel
325
327
  - [Faker:Travel::Airport](doc/travel/airport.md)
328
+ </details>
329
+
330
+ <details>
331
+ <summary>Creature</summary>
326
332
 
327
333
  - [Faker::Creature::Animal](doc/creature/animal.md)
328
334
  - [Faker::Creature::Bird](doc/creature/bird.md)
@@ -377,6 +383,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
377
383
  <summary>Movies</summary>
378
384
 
379
385
  - [Faker::Movie](doc/movies/movie.md)
386
+ - [Faker::Movies::Avatar](doc/movies/avatar.md)
380
387
  - [Faker::Movies::BackToTheFuture](doc/movies/back_to_the_future.md)
381
388
  - [Faker::Movies::Departed](doc/movies/departed.md)
382
389
  - [Faker::Movies::Ghostbusters](doc/movies/ghostbusters.md)
@@ -421,6 +428,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
421
428
 
422
429
  - [Faker::Sports](doc/sports/sports.md)
423
430
  - [Faker::Sports::Basketball](doc/sports/basketball.md)
431
+ - [Faker::Sports::Chess](doc/sports/chess.md)
424
432
  - [Faker::Sports::Football](doc/sports/football.md)
425
433
  - [Faker::Sports::Mountaineering](doc/sports/mountaineering.md)
426
434
  - [Faker::Sports::Volleyball](doc/sports/volleyball.md)
@@ -151,6 +151,19 @@ module Faker
151
151
  fetch('company.profession')
152
152
  end
153
153
 
154
+ ##
155
+ # Produces a company department.
156
+ #
157
+ # @return [String]
158
+ #
159
+ # @example
160
+ # Faker::Company.department #=> "Information Technology"
161
+ #
162
+ # @faker.version next
163
+ def department
164
+ fetch('company.department')
165
+ end
166
+
154
167
  ##
155
168
  # Produces a company spanish organisation number.
156
169
  #
@@ -5,6 +5,19 @@ module Faker
5
5
  flexible :food
6
6
 
7
7
  class << self
8
+ ##
9
+ # Retrieves an allergen.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Food.allergen #=> "Peanuts"
15
+ #
16
+ # @faker.version next
17
+ def allergen
18
+ fetch('food.allergens')
19
+ end
20
+
8
21
  ##
9
22
  # Retrieves a typical dish from each country.
10
23
  #
@@ -15,6 +15,8 @@ module Faker
15
15
  ].each(&:freeze).freeze
16
16
 
17
17
  class << self
18
+ extend Gem::Deprecate
19
+
18
20
  ##
19
21
  # Returns the email address
20
22
  #
@@ -25,10 +27,11 @@ module Faker
25
27
  # @param domain [String]
26
28
  #
27
29
  # @example
28
- # Faker::Internet.email #=> "samsmith@faker.com"
29
- # Faker::Internet.email(name: 'smith') #=> "smith@faker.com"
30
- # Faker::Internet.email(name: 'sam smith', separators: ['-']) #=> "sam-smith@faker.com"
31
- # Faker::Internet.email(name: 'sam smith', separators: ['-'], domain: 'gmail') #=> "sam-smith@gmail.com"
30
+ # Faker::Internet.email #=> "renee@zieme.test"
31
+ # Faker::Internet.email(name: 'smith') #=> "smith@bergnaum.test"
32
+ # Faker::Internet.email(name: 'sam smith', separators: ['-']) #=> "smith-sam@tromp.example"
33
+ # Faker::Internet.email(name: 'sam smith', separators: ['-'], domain: 'test') #=> "sam-smith@test.example"
34
+ # Faker::Internet.email(domain: 'gmail.com') #=> "foo@gmail.com"
32
35
  def email(name: nil, separators: nil, domain: nil)
33
36
  local_part = if separators
34
37
  username(specifier: name, separators: separators)
@@ -37,7 +40,14 @@ module Faker
37
40
  end
38
41
 
39
42
  sanitized_local_part = sanitize_email_local_part(local_part)
40
- construct_email(sanitized_local_part, domain_name(domain: domain))
43
+
44
+ generate_domain = if domain.nil?
45
+ domain_name
46
+ else
47
+ domain_name(domain: domain)
48
+ end
49
+
50
+ construct_email(sanitized_local_part, generate_domain)
41
51
  end
42
52
 
43
53
  ##
@@ -56,6 +66,7 @@ module Faker
56
66
  fetch('internet.free_email')
57
67
  )
58
68
  end
69
+ deprecate :free_email, :email, 2023, 10
59
70
 
60
71
  ##
61
72
  # Returns the email address with fixed domain name as 'example'
@@ -73,6 +84,7 @@ module Faker
73
84
  "example.#{sample(%w[org com net])}"
74
85
  )
75
86
  end
87
+ deprecate :safe_email, :email, 2023, 10
76
88
 
77
89
  ##
78
90
  # Returns the username
@@ -174,6 +186,10 @@ module Faker
174
186
  password << lower_chars[rand(lower_chars.count - 1)]
175
187
  character_bag += lower_chars
176
188
 
189
+ digits = ('1'..'9').to_a
190
+ password << digits[rand(digits.count - 1)]
191
+ character_bag += digits
192
+
177
193
  if character_types.include?(:mix_case)
178
194
  upper_chars = ('A'..'Z').to_a
179
195
  password << upper_chars[rand(upper_chars.count - 1)]
@@ -200,10 +216,12 @@ module Faker
200
216
  # @param domain [String]
201
217
  #
202
218
  # @example
203
- # Faker::Internet.domain_name #=> "test.net"
204
- # Faker::Internet.domain_name(subdomain: true) #=> "test.faker.io"
205
- # Faker::Internet.domain_name(subdomain: true, domain: 'example') #=> "faker.example.com"
206
- # Faker::Internet.domain_name(domain: 'faker') #=> "faker.org"
219
+ # Faker::Internet.domain_name #=> "altenwerth-gerhold.example"
220
+ # Faker::Internet.domain_name(subdomain: true) #=> "metz.mclaughlin-brekke.test"
221
+ # Faker::Internet.domain_name(subdomain: true, domain: 'faker') #=> "foo.faker.test"
222
+ # Faker::Internet.domain_name(domain: 'faker-ruby.org') #=> "faker-ruby.org"
223
+ # Faker::Internet.domain_name(subdomain: true, domain: 'faker-ruby.org') #=> "foo.faker-ruby.org"
224
+ # Faker::Internet.domain_name(subdomain: true, domain: 'faker.faker-ruby.org') #=> "faker.faker-ruby.org"
207
225
  def domain_name(subdomain: false, domain: nil)
208
226
  with_locale(:en) do
209
227
  if domain
@@ -211,12 +229,18 @@ module Faker
211
229
  .split('.')
212
230
  .map { |domain_part| Char.prepare(domain_part) }
213
231
  .tap do |domain_elements|
214
- domain_elements << domain_suffix if domain_elements.length < 2
215
- domain_elements.unshift(Char.prepare(domain_word)) if subdomain && domain_elements.length < 3
232
+ if domain_elements.length < 2
233
+ domain_elements << domain_suffix(safe: true)
234
+ end
235
+ if subdomain && domain_elements.length < 3
236
+ domain_elements.unshift(Char.prepare(domain_word))
237
+ end
216
238
  end.join('.')
217
239
  else
218
- [domain_word, domain_suffix].tap do |domain_elements|
219
- domain_elements.unshift(Char.prepare(domain_word)) if subdomain
240
+ [domain_word, domain_suffix(safe: true)].tap do |domain_elements|
241
+ if subdomain
242
+ domain_elements.unshift(Char.prepare(domain_word))
243
+ end
220
244
  end.join('.')
221
245
  end
222
246
  end
@@ -253,10 +277,16 @@ module Faker
253
277
  # @return [String]
254
278
  #
255
279
  # @example
256
- # Faker::Internet.domain_suffix #=> "com"
257
- # Faker::Internet.domain_suffix #=> "biz"
258
- def domain_suffix
259
- fetch('internet.domain_suffix')
280
+ # Faker::Internet.domain_suffix #=> "com"
281
+ # Faker::Internet.domain_suffix #=> "biz"
282
+ # Faker::Internet.domain_suffix(safe: true) #=> "example"
283
+ # Faker::Internet.domain_suffix(safe: true) #=> "test"
284
+ def domain_suffix(safe: nil)
285
+ if safe
286
+ fetch('internet.safe_domain_suffix')
287
+ else
288
+ fetch('internet.domain_suffix')
289
+ end
260
290
  end
261
291
 
262
292
  ##
@@ -421,10 +451,10 @@ module Faker
421
451
  # @param scheme [String]
422
452
  #
423
453
  # @example
424
- # Faker::Internet.url #=> "http://sipes-okon.com/hung.macejkovic"
454
+ # Faker::Internet.url #=> "http://treutel.test/demarcus"
425
455
  # Faker::Internet.url(host: 'faker') #=> "http://faker/shad"
426
- # Faker::Internet.url(host: 'faker', path: '/fake_test_path') #=> "http://faker/fake_test_path"
427
- # Faker::Internet.url(host: 'faker', path: '/fake_test_path', scheme: 'https') #=> "https://faker/fake_test_path"
456
+ # Faker::Internet.url(host: 'faker', path: '/docs') #=> "http://faker/docs"
457
+ # Faker::Internet.url(host: 'faker', path: '/docs', scheme: 'https') #=> "https://faker/docs"
428
458
  def url(host: domain_name, path: "/#{username}", scheme: 'http')
429
459
  "#{scheme}://#{host}#{path}"
430
460
  end
@@ -542,10 +572,10 @@ module Faker
542
572
  ##
543
573
  # Produces a randomized hash of internet user details
544
574
  # @example
545
- # Faker::Internet.user #=> { username: 'alexie', email: 'alexie@example.net' }
575
+ # Faker::Internet.user #=> { username: 'alexie', email: 'trudie@grant.test' }
546
576
  #
547
577
  # @example
548
- # Faker::Internet.user('username', 'email', 'password') #=> { username: 'alexie', email: 'alexie@example.net', password: 'DtEf9P8wS31iMyC' }
578
+ # Faker::Internet.user('username', 'email', 'password') #=> { username: 'alexie', email: 'gayle@kohler.test', password: 'DtEf9P8wS31iMyC' }
549
579
  #
550
580
  # @return [hash]
551
581
  #
@@ -6,7 +6,7 @@ module Faker
6
6
 
7
7
  class << self
8
8
  ##
9
- # Produces the name of a video game console or platform.
9
+ # Produces a few marketing buzzwords.
10
10
  #
11
11
  # @return [String]
12
12
  #
@@ -12,7 +12,7 @@ module Faker
12
12
  super()
13
13
 
14
14
  @name = name || "#{Name.first_name} #{Name.last_name}"
15
- @email = email || Internet.safe_email(name: self.name)
15
+ @email = email || Internet.email(name: self.name)
16
16
  @first_name, @last_name = self.name.split
17
17
  end
18
18
 
@@ -63,7 +63,7 @@ module Faker
63
63
  verified: Faker::Boolean.boolean(true_ratio: 0.1)
64
64
  }
65
65
  user[:status] = Faker::Twitter.status(include_user: false) if include_status
66
- user[:email] = Faker::Internet.safe_email if include_email
66
+ user[:email] = Faker::Internet.email if include_email
67
67
  user
68
68
  end
69
69
 
@@ -43,6 +43,19 @@ module Faker
43
43
  fetch('dnd.cities')
44
44
  end
45
45
 
46
+ ##
47
+ # Produces the first name of a character or monster from Dungeons and Dragons.
48
+ #
49
+ # @return [String]
50
+ #
51
+ # @example
52
+ # Faker::Games::DnD.name #=> "Eilonwy"
53
+ #
54
+ # @faker.version next
55
+ def first_name
56
+ fetch('dnd.name.first_name')
57
+ end
58
+
46
59
  ##
47
60
  # Produces the name of a class from Dungeons and Dragons (PHB).
48
61
  #
@@ -69,6 +82,19 @@ module Faker
69
82
  fetch('dnd.languages')
70
83
  end
71
84
 
85
+ ##
86
+ # Produces a last name from Dungeons and Dragons.
87
+ #
88
+ # @return [String]
89
+ #
90
+ # @example
91
+ # Faker::Games::DnD.last_name #=> "Leafwhisper"
92
+ #
93
+ # @faker.version next
94
+ def last_name
95
+ fetch('dnd.name.last_name')
96
+ end
97
+
72
98
  ##
73
99
  # Produces the name of a melee weapon from Dungeons and Dragons.
74
100
  #
@@ -95,6 +121,19 @@ module Faker
95
121
  fetch('dnd.monsters')
96
122
  end
97
123
 
124
+ ##
125
+ # Produces a full name from Dungeons and Dragons.
126
+ #
127
+ # @return [String]
128
+ #
129
+ # @example
130
+ # Faker::Games::DnD.name #=> "Drakon Blackthorn"
131
+ #
132
+ # @faker.version next
133
+ def name
134
+ "#{fetch('dnd.name.first_name')} #{fetch('dnd.name.last_name')}"
135
+ end
136
+
98
137
  ##
99
138
  # Produces the name of a race from Dungeons and Dragons (PHB).
100
139
  #
@@ -121,14 +160,17 @@ module Faker
121
160
  fetch('dnd.ranged_weapons')
122
161
  end
123
162
 
124
- # This method is deprecated. The implementation will be removed in a near future release.
125
- # Use `DnD.race` instead.
163
+ ##
164
+ # Produces a last name from Dungeons and Dragons.
126
165
  #
127
- # @deprecated Use {#race} instead.
128
- def species
129
- warn '`DnD.species` is deprecated. Use `DnD.race` instead.'
130
-
131
- super
166
+ # @return [String]
167
+ #
168
+ # @example
169
+ # Faker::Games::DnD.title_name #=> "Corvus the Cunning"
170
+ #
171
+ # @faker.version next
172
+ def title_name
173
+ "#{fetch('dnd.name.first_name')} #{fetch('dnd.name.title')}"
132
174
  end
133
175
  end
134
176
  end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Faker
4
+ class Movies
5
+ class Avatar < Base
6
+ class << self
7
+ ##
8
+ # Produces a character from Avatar.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Movies::Avatar.character #=> "Jake Sully"
14
+ #
15
+ # @faker.version next
16
+ def character
17
+ fetch('avatar.characters')
18
+ end
19
+
20
+ ##
21
+ # Produces a date from Avatar.
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Movies::Avatar.date #=> "December 15, 2022"
27
+ #
28
+ # @faker.version next
29
+ def date
30
+ fetch('avatar.dates')
31
+ end
32
+
33
+ ##
34
+ # Produces a quote from Avatar.
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Movies::Avatar.quote
40
+ # #=> "If it ain't raining, we ain't training."
41
+ #
42
+ # @faker.version next
43
+ def quote
44
+ fetch('avatar.quotes')
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -106,6 +106,19 @@ module Faker
106
106
  def fortune_cookie
107
107
  fetch('quote.fortune_cookie')
108
108
  end
109
+
110
+ ##
111
+ # Produces a quote from comedian Mitch Hedberg.
112
+ #
113
+ # @return [String]
114
+ #
115
+ # @example
116
+ # Faker::Quote.mitch_hedberg # => "I like Kit-Kats, unless I'm with four or more people."
117
+ #
118
+ # @faker.version next
119
+ def mitch_hedberg
120
+ fetch('quote.mitch_hedberg')
121
+ end
109
122
  end
110
123
  end
111
124
  end
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Faker
4
+ class Sports
5
+ class Chess < Base
6
+ class << self
7
+ ##
8
+ # Produces the name of a chess player name.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Sports::Chess.player #=> "Golden State Warriors"
14
+ #
15
+ # @faker.version next
16
+ def player
17
+ fetch('chess.players')
18
+ end
19
+
20
+ ##
21
+ # Produces a long (alpha-3) ISO 3166 country code.
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Chess.federation #=> "COL"
27
+ #
28
+ # @faker.version next
29
+ def federation
30
+ Faker::Address.country_code_long
31
+ end
32
+
33
+ def tournament
34
+ ##
35
+ # Produces the name of a famous chess tournament name.
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example
40
+ # Faker::Chess.tournament #=> "Khanty-Mansisyk (Candidates Tournament)"
41
+ #
42
+ # @faker.version next
43
+ fetch('chess.tournaments')
44
+ end
45
+
46
+ def rating(from: 2000, to: 2900)
47
+ ##
48
+ # Produces a rating between two provided values. Boundaries are inclusive.
49
+ #
50
+ # @param from [Numeric] The lowest number to include.
51
+ # @param to [Numeric] The highest number to include.
52
+ # @return [Numeric]
53
+ #
54
+ # @example
55
+ # Faker::Sports::Chess.rating #=> 2734
56
+ # Faker::Sports::Chess.rating(from: 2400, to: 2700) #=> 2580
57
+ #
58
+ # @faker.version next
59
+ Faker::Base.rand_in_range(from, to)
60
+ end
61
+
62
+ ##
63
+ # Produces the name of a chess opening.
64
+ #
65
+ # @return [String]
66
+ #
67
+ # @example
68
+ # Faker::Sports::Chess.opening #=> "Giuoco Piano"
69
+ #
70
+ # @faker.version next
71
+ def opening
72
+ fetch('chess.openings')
73
+ end
74
+
75
+ ##
76
+ # Produces a chess title.
77
+ #
78
+ # @return [String]
79
+ #
80
+ # @example
81
+ # Faker::Sports::Chess.title #=> "GM"
82
+ #
83
+ # @faker.version next
84
+ def title
85
+ fetch('chess.titles')
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -19,8 +19,6 @@ module Faker
19
19
  # @faker.version next
20
20
  def name(size:, region:)
21
21
  fetch("airport.#{region}.#{size}")
22
- rescue I18n::MissingTranslationData
23
- p 'valid arguments are size && region -> US has size large medium small, EU has size large medium -- united_states || european_union'
24
22
  end
25
23
 
26
24
  ##
@@ -38,8 +36,6 @@ module Faker
38
36
  # @faker.version next
39
37
  def iata(size:, region:)
40
38
  fetch("airport.#{region}.iata_code.#{size}")
41
- rescue I18n::MissingTranslationData
42
- p 'valid arguments are size && region -> US has size large medium small, EU has size large medium -- united_states || european_union'
43
39
  end
44
40
  end
45
41
  end
data/lib/faker/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Faker # :nodoc:
4
- VERSION = '3.1.1'
4
+ VERSION = '3.2.0'
5
5
  end
data/lib/faker.rb CHANGED
@@ -8,7 +8,6 @@ require 'i18n'
8
8
  Dir.glob(File.join(mydir, 'helpers', '*.rb')).sort.each { |file| require file }
9
9
 
10
10
  I18n.load_path += Dir[File.join(mydir, 'locales', '**/*.yml')]
11
- I18n.reload! if I18n.backend.initialized?
12
11
 
13
12
  module Faker
14
13
  module Config