faker 3.5.3 → 3.6.1

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 (229) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +79 -0
  3. data/README.md +6 -7
  4. data/lib/faker/blockchain/bitcoin.rb +0 -1
  5. data/lib/faker/blockchain/tezos.rb +0 -1
  6. data/lib/faker/default/avatar.rb +1 -1
  7. data/lib/faker/default/crypto.rb +0 -2
  8. data/lib/faker/default/id_number.rb +1 -1
  9. data/lib/faker/default/lorem_flickr.rb +1 -1
  10. data/lib/faker/default/placeholdit.rb +1 -1
  11. data/lib/faker/default/string.rb +1 -1
  12. data/lib/faker/default/x.rb +189 -0
  13. data/lib/faker/music/bossa_nova.rb +0 -4
  14. data/lib/faker/version.rb +1 -1
  15. data/lib/faker.rb +13 -10
  16. data/lib/helpers/unique_generator.rb +1 -1
  17. data/lib/locales/README.md +2 -2
  18. data/lib/locales/ar.yml +8 -4
  19. data/lib/locales/bg.yml +935 -18
  20. data/lib/locales/ca-CAT.yml +347 -12
  21. data/lib/locales/ca.yml +580 -7
  22. data/lib/locales/ee.yml +1184 -27
  23. data/lib/locales/en/adjective.yml +174 -174
  24. data/lib/locales/en/airport.yml +374 -374
  25. data/lib/locales/en/ancient.yml +128 -4
  26. data/lib/locales/en/animal.yml +141 -2
  27. data/lib/locales/en/app.yml +89 -2
  28. data/lib/locales/en/appliance.yml +81 -2
  29. data/lib/locales/en/aqua_teen_hunger_force.yml +31 -31
  30. data/lib/locales/en/artist.yml +43 -1
  31. data/lib/locales/en/avatar.yml +54 -28
  32. data/lib/locales/en/back_to_the_future.yml +145 -117
  33. data/lib/locales/en/bank.yml +91 -2
  34. data/lib/locales/en/beer.yml +232 -6
  35. data/lib/locales/en/bible.yml +3 -6
  36. data/lib/locales/en/big_bang_theory.yml +34 -35
  37. data/lib/locales/en/bird.yml +1225 -1226
  38. data/lib/locales/en/bojack_horseman.yml +63 -3
  39. data/lib/locales/en/bossa_nova.yml +110 -3
  40. data/lib/locales/en/breaking_bad.yml +110 -25
  41. data/lib/locales/en/brooklyn_nine_nine.yml +0 -1
  42. data/lib/locales/en/buffy.yml +239 -257
  43. data/lib/locales/en/business.yml +18 -2
  44. data/lib/locales/en/cannabis.yml +344 -10
  45. data/lib/locales/en/cat.yml +155 -3
  46. data/lib/locales/en/chess.yml +2 -3
  47. data/lib/locales/en/chiquito.yml +60 -61
  48. data/lib/locales/en/chuck_norris.yml +78 -79
  49. data/lib/locales/en/clash_of_clan.yml +0 -2
  50. data/lib/locales/en/code.yml +501 -1
  51. data/lib/locales/en/coffee.yml +450 -25
  52. data/lib/locales/en/color.yml +73 -1
  53. data/lib/locales/en/commerce.yml +117 -23
  54. data/lib/locales/en/community.yml +55 -30
  55. data/lib/locales/en/company.yml +1756 -14
  56. data/lib/locales/en/compass.yml +108 -12
  57. data/lib/locales/en/conan.yml +0 -2
  58. data/lib/locales/en/construction.yml +416 -422
  59. data/lib/locales/en/cosmere.yml +219 -54
  60. data/lib/locales/en/cowboy_bebop.yml +56 -59
  61. data/lib/locales/en/culture_series.yml +298 -298
  62. data/lib/locales/en/currency.yml +358 -3
  63. data/lib/locales/en/dc_comics.yml +178 -49
  64. data/lib/locales/en/demographic.yml +215 -215
  65. data/lib/locales/en/departed.yml +40 -44
  66. data/lib/locales/en/dessert.yml +78 -3
  67. data/lib/locales/en/doraemon.yml +278 -280
  68. data/lib/locales/en/dr_who.yml +468 -93
  69. data/lib/locales/en/dragon_ball.yml +240 -240
  70. data/lib/locales/en/dumb_and_dumber.yml +72 -56
  71. data/lib/locales/en/elder_scrolls.yml +1 -1
  72. data/lib/locales/en/electrical_components.yml +49 -3
  73. data/lib/locales/en/esport.yml +58 -5
  74. data/lib/locales/en/family_guy.yml +54 -4
  75. data/lib/locales/en/file.yml +108 -9
  76. data/lib/locales/en/final_space.yml +1 -3
  77. data/lib/locales/en/food.yml +1 -1
  78. data/lib/locales/en/football.yml +112 -5
  79. data/lib/locales/en/fresh_prince_of_bel_air.yml +119 -70
  80. data/lib/locales/en/friends.yml +162 -3
  81. data/lib/locales/en/funny_name.yml +752 -1
  82. data/lib/locales/en/futurama.yml +7 -15
  83. data/lib/locales/en/game_of_thrones.yml +2487 -5
  84. data/lib/locales/en/gender.yml +15 -3
  85. data/lib/locales/en/ghostbusters.yml +101 -88
  86. data/lib/locales/en/grateful_dead.yml +47 -45
  87. data/lib/locales/en/greek_philosophers.yml +44 -23
  88. data/lib/locales/en/hacker.yml +110 -5
  89. data/lib/locales/en/hackers.yml +1 -1
  90. data/lib/locales/en/harry_potter.yml +323 -6
  91. data/lib/locales/en/hey_arnold.yml +104 -21
  92. data/lib/locales/en/hipster.yml +203 -1
  93. data/lib/locales/en/hitchhikers_guide_to_the_galaxy.yml +243 -42
  94. data/lib/locales/en/horse.yml +446 -2
  95. data/lib/locales/en/house.yml +34 -2
  96. data/lib/locales/en/how_i_met_your_mother.yml +97 -25
  97. data/lib/locales/en/how_to_train_your_dragon.yml +0 -1
  98. data/lib/locales/en/id_number.yml +6 -1
  99. data/lib/locales/en/industry_segments.yml +188 -4
  100. data/lib/locales/en/job.yml +98 -7
  101. data/lib/locales/en/kamen_rider.yml +272 -6
  102. data/lib/locales/en/kpop.yml +954 -80
  103. data/lib/locales/en/lebowski.yml +58 -40
  104. data/lib/locales/en/lorem.yml +1095 -6
  105. data/lib/locales/en/markdown.yml +12 -2
  106. data/lib/locales/en/marketing.yml +54 -1
  107. data/lib/locales/en/measurement.yml +42 -8
  108. data/lib/locales/en/michael_scott.yml +41 -42
  109. data/lib/locales/en/movie.yml +188 -176
  110. data/lib/locales/en/name.yml +6068 -6
  111. data/lib/locales/en/nato_phonetic_alphabet.yml +27 -1
  112. data/lib/locales/en/new_girl.yml +35 -37
  113. data/lib/locales/en/one_piece.yml +359 -6
  114. data/lib/locales/en/opera.yml +1 -1
  115. data/lib/locales/en/parks_and_rec.yml +33 -4
  116. data/lib/locales/en/pearl_jam.yml +207 -207
  117. data/lib/locales/en/phish.yml +388 -389
  118. data/lib/locales/en/prince.yml +219 -219
  119. data/lib/locales/en/princess_bride.yml +48 -2
  120. data/lib/locales/en/programming_language.yml +753 -3
  121. data/lib/locales/en/quote.yml +599 -685
  122. data/lib/locales/en/rajnikanth.yml +74 -74
  123. data/lib/locales/en/relationship.yml +29 -6
  124. data/lib/locales/en/restaurant.yml +31 -31
  125. data/lib/locales/en/rick_and_morty.yml +116 -3
  126. data/lib/locales/en/rock_band.yml +228 -2
  127. data/lib/locales/en/rupaul.yml +120 -122
  128. data/lib/locales/en/seinfeld.yml +110 -3
  129. data/lib/locales/en/shakespeare.yml +46 -50
  130. data/lib/locales/en/silicon_valley.yml +122 -50
  131. data/lib/locales/en/simpsons.yml +897 -691
  132. data/lib/locales/en/slack_emoji.yml +874 -8
  133. data/lib/locales/en/space.yml +373 -14
  134. data/lib/locales/en/star_trek.yml +105 -4
  135. data/lib/locales/en/star_wars.yml +525 -528
  136. data/lib/locales/en/stargate.yml +65 -18
  137. data/lib/locales/en/stranger_thing.yml +31 -33
  138. data/lib/locales/en/subscription.yml +47 -5
  139. data/lib/locales/en/superhero.yml +574 -4
  140. data/lib/locales/en/sword_art_online.yml +327 -331
  141. data/lib/locales/en/team.yml +125 -3
  142. data/lib/locales/en/the_expanse.yml +92 -4
  143. data/lib/locales/en/the_it_crowd.yml +148 -152
  144. data/lib/locales/en/the_office.yml +77 -81
  145. data/lib/locales/en/the_room.yml +35 -35
  146. data/lib/locales/en/the_thick_of_it.yml +83 -3
  147. data/lib/locales/en/theater.yml +593 -593
  148. data/lib/locales/en/tolkien.yml +2 -2
  149. data/lib/locales/en/touhou.yml +54 -54
  150. data/lib/locales/en/tron.yml +191 -191
  151. data/lib/locales/en/twin_peaks.yml +130 -3
  152. data/lib/locales/en/umphreys_mcgee.yml +266 -1
  153. data/lib/locales/en/university.yml +15 -2
  154. data/lib/locales/en/v_for_vendetta.yml +157 -160
  155. data/lib/locales/en/venture_bros.yml +225 -4
  156. data/lib/locales/en/verbs.yml +3785 -5
  157. data/lib/locales/en/volleyball.yml +493 -493
  158. data/lib/locales/en/warhammer_fantasy.yml +540 -573
  159. data/lib/locales/en/world_cup.yml +1132 -235
  160. data/lib/locales/en/yoda.yml +38 -1
  161. data/lib/locales/en-BORK.yml +104 -1
  162. data/lib/locales/en-NG.yml +737 -66
  163. data/lib/locales/en-TH.yml +1 -1
  164. data/lib/locales/en-UG.yml +374 -76
  165. data/lib/locales/en-ZA.yml +1394 -13
  166. data/lib/locales/es-AR.yml +1 -1
  167. data/lib/locales/es-MX.yml +1907 -40
  168. data/lib/locales/es.yml +2117 -52
  169. data/lib/locales/fa.yml +1624 -5
  170. data/lib/locales/fi-FI.yml +315 -17
  171. data/lib/locales/fr/adjective.yml +261 -261
  172. data/lib/locales/fr/ancient.yml +134 -134
  173. data/lib/locales/fr/animal.yml +118 -1
  174. data/lib/locales/fr/appliance.yml +66 -1
  175. data/lib/locales/fr/book.yml +27 -3
  176. data/lib/locales/fr/color.yml +31 -1
  177. data/lib/locales/fr/company.yml +490 -10
  178. data/lib/locales/fr/compass.yml +58 -10
  179. data/lib/locales/fr/demographic.yml +3 -1
  180. data/lib/locales/fr/gender.yml +18 -3
  181. data/lib/locales/fr/internet.yml +12 -1
  182. data/lib/locales/fr/lorem.yml +1091 -2
  183. data/lib/locales/fr/measurement.yml +31 -4
  184. data/lib/locales/fr/name.yml +1176 -5
  185. data/lib/locales/fr/phone_number.yml +34 -3
  186. data/lib/locales/fr/pokemon.yml +417 -3
  187. data/lib/locales/fr-CA.yml +12 -6
  188. data/lib/locales/fr-CH.yml +2455 -41
  189. data/lib/locales/he.yml +255 -9
  190. data/lib/locales/hy.yml +12 -6
  191. data/lib/locales/it.yml +12 -6
  192. data/lib/locales/ja/address.yml +350 -120526
  193. data/lib/locales/ja/ancient.yml +15 -1
  194. data/lib/locales/ja/animal.yml +83 -1
  195. data/lib/locales/ja/bank.yml +136 -1
  196. data/lib/locales/ja/cat.yml +75 -1
  197. data/lib/locales/ja/coffee.yml +19 -1
  198. data/lib/locales/ja/color.yml +32 -1
  199. data/lib/locales/ja/commerce.yml +98 -6
  200. data/lib/locales/ja/company.yml +20 -2
  201. data/lib/locales/ja/dog.yml +335 -2
  202. data/lib/locales/ja/emotion.yml +1 -3
  203. data/lib/locales/ja/food.yml +38 -1
  204. data/lib/locales/ja/gender.yml +3 -1
  205. data/lib/locales/ja/lorem.yml +1014 -3
  206. data/lib/locales/ja/name.yml +203 -3
  207. data/lib/locales/ja/overwatch.yml +33 -1
  208. data/lib/locales/ja/phone_number.yml +9 -3
  209. data/lib/locales/ja/pokemon.yml +437 -3
  210. data/lib/locales/ja/relationship.yml +29 -6
  211. data/lib/locales/ja/restaurant.yml +74 -3
  212. data/lib/locales/ja/space.yml +20 -2
  213. data/lib/locales/ja/subscription.yml +47 -5
  214. data/lib/locales/ja/super_mario.yml +68 -4
  215. data/lib/locales/ja/university.yml +15 -2
  216. data/lib/locales/ja/zelda.yml +15 -1
  217. data/lib/locales/ko.yml +1 -1
  218. data/lib/locales/lv.yml +1221 -26
  219. data/lib/locales/nl.yml +33507 -56
  220. data/lib/locales/pl.yml +4008 -37
  221. data/lib/locales/sk.yml +12 -6
  222. data/lib/locales/sv.yml +639 -49
  223. data/lib/locales/th.yml +375 -375
  224. data/lib/locales/tr.yml +77 -18
  225. data/lib/locales/vi.yml +392 -49
  226. data/lib/locales/zh-CN.yml +540 -19
  227. data/lib/locales/zh-TW.yml +1030 -15
  228. metadata +4 -4
  229. data/lib/faker/default/twitter.rb +0 -401
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1451a74f2ed552404727bf2dfe6711edcdd7c6231cb1780a0d99050324b7b448
4
- data.tar.gz: 63bdcd753bb373c03dc1f43e36a9fd79622ffe09c9a2c5748759475901b251e1
3
+ metadata.gz: f0f1f57798bdd12f9abe18fb1addd4d6ed4126bd9dd6511f85f65db979a8f09f
4
+ data.tar.gz: 11c90330d5e8d3aa1135acd2ec8b830ccdc84bfecfdab608a5104e73cc5cf46f
5
5
  SHA512:
6
- metadata.gz: eca06030ce6ac8b3000d35df1214b262cd929964ab0c4fc23c5501ff0f6d5ed2717361bc61f7da2be2edc909cae5a1c17f762f2df1a2a2c77250c98db7167ab6
7
- data.tar.gz: 49effb24c9837d69685458f9763cde1194164466c3adc73851ec8cbba680804def10fe8e94d6f89acf7ef7e2e6503a74905ef76302521d80adf548ab88c88879
6
+ metadata.gz: cc7aefa18cbf98cb6cf85de656e2b61bbc4c9ef42ba40f381113b3c7ec22be420ea04fa8cc8d7ae1ed30871bc95ce8a14117ae6d600a97b78c16857b2bf05fd2
7
+ data.tar.gz: 3f82d2eda0d9758364947ae6642f1d92b0db82589884a83a42f3ac08ae30cd59b85c0b60dc1b712595e2950cc97e8c1adb266445cdaea54725b195bd3ec17d1a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,84 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.6.1](https://github.com/faker-ruby/faker/tree/v3.6.1) (2026-03-04)
4
+
5
+ It's almost Spring time in the Northern hemisphere 🌸
6
+
7
+ ### Security, performance improvements and bug fixes
8
+
9
+ * fix: polynomial regex on uncontrolled input by @thdaraujo in https://github.com/faker-ruby/faker/pull/3196
10
+ * perf: replaces list of postcodes in `ja/address.yml` with a 7-digit format by @thdaraujo in https://github.com/faker-ruby/faker/pull/3201
11
+ * Remove unnecessary whitespace from code blocks in READMEs by @ryotaro-shirai in https://github.com/faker-ruby/faker/pull/3209
12
+ * Document lazy load experiment results by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3205
13
+ * [skip ci] Add-backtick by @OzuAkira in https://github.com/faker-ruby/faker/pull/3210
14
+ * Zeitwerk experiment changes and results [skip ci] by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3213
15
+ * Remove duplicate reference link in README.md by @yutasb in https://github.com/faker-ruby/faker/pull/3217
16
+
17
+ ### Update development dependencies
18
+
19
+ * Bump rubocop from 1.84.0 to 1.84.1 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3202
20
+ * Bump irb from 1.16.0 to 1.17.0 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3203
21
+ * Bump rubocop version and fix offenses by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3198
22
+ * Bump rdoc from 7.1.0 to 7.2.0 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3204
23
+ * Bump rubocop to 1.84.2 by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3215
24
+ * Bump rubocop-minitest from 0.38.2 to 0.39.1 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3216
25
+ * Bump rubocop to v1.85.0 by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3220
26
+
27
+ ### New Contributors
28
+ * @ryotaro-shirai made their first contribution in https://github.com/faker-ruby/faker/pull/3209
29
+ * @OzuAkira made their first contribution in https://github.com/faker-ruby/faker/pull/3210
30
+ * @yutasb made their first contribution in https://github.com/faker-ruby/faker/pull/3217
31
+
32
+ **Full Changelog**: https://github.com/faker-ruby/faker/compare/v3.6.0...v3.6.1
33
+
34
+ ---------------------------------
35
+
36
+ ## [v3.6.0](https://github.com/faker-ruby/faker/tree/v3.6.0) (2026-01-21)
37
+
38
+ First release of the new year!
39
+
40
+ This version comes with some performance improvements (speeds faker load time by 17%!) and removal of deprecated generators.
41
+
42
+ It also drops support to Ruby's EOL `3.0`. The minimum supported Ruby version is `3.1`.
43
+
44
+ ### Drops support for Ruby 3.0
45
+
46
+ * Drop support for Ruby EOL 3.0 by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3167
47
+
48
+ ### Removes deprecated generators
49
+
50
+ * `Faker::Twitter` and `Faker::BossaNova` have been removed. Please use the new generators `Faker::X` and `Faker::Music::BossaNova` and check the new docs for more details in https://github.com/faker-ruby/faker/pull/3190
51
+
52
+ ### Improvements and bug fixes
53
+
54
+ * Autoload OpenSSL by @stefannibrasil and @thdaraujo in https://github.com/faker-ruby/faker/pull/3188 - this speeds faker load time by 17%!
55
+ * Fix typos in README.md by @CarlosCalgaro in https://github.com/faker-ruby/faker/pull/3156
56
+ * fix: badly anchored regexes by @thdaraujo in https://github.com/faker-ruby/faker/pull/3181
57
+ * Benchmark revamp + run benchmark as part of CI by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3176
58
+ * Add reformat locales rake task by @thdaraujo in https://github.com/faker-ruby/faker/pull/3061
59
+ * Add option to trigger GH workflows manually by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3187
60
+
61
+ ### Update development dependencies
62
+
63
+ * Bump bundler version by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3165
64
+ * Add GitHub actions to dependabot workflow by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3168
65
+ * Bump pry from 0.15.2 to 0.16.0 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3175
66
+ * Bump i18n from 1.14.7 to 1.14.8 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3174
67
+ * Bump yard from 0.9.37 to 0.9.38 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3173
68
+ * Bump actions/checkout from 3 to 6 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3170
69
+ * Bump test-unit from 3.7.1 to 3.7.7 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3172
70
+ * Bump github/codeql-action from 2 to 4 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3169
71
+ * Bump rubocop from 1.81.7 to 1.82.1 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3171
72
+ * Bump minitest from 5.26.1 to 5.27.0 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3177
73
+ * Bump 'rdoc' dependency, handle 'erb' version constraint with Ruby 3.1 and improve CI bundle cache by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3185
74
+
75
+ ### New Contributors
76
+ * @CarlosCalgaro made their first contribution in https://github.com/faker-ruby/faker/pull/3156
77
+
78
+ **Full Changelog**: https://github.com/faker-ruby/faker/compare/v3.5.3...v3.6.0
79
+
80
+ ---------------------------------
81
+
3
82
  ## [v3.5.3](https://github.com/faker-ruby/faker/tree/v3.5.3) (2025-12-02)
4
83
 
5
84
  Wishing you a cozy and calm Holiday season ☃️
data/README.md CHANGED
@@ -11,7 +11,6 @@
11
11
  [github-actions]: https://github.com/faker-ruby/faker/actions
12
12
  [downloads-total]: https://img.shields.io/gem/dt/faker.svg
13
13
  [downloads-badge]: https://img.shields.io/gem/dtv/faker.svg
14
- [downloads-badge]: https://img.shields.io/gem/dtv/faker.svg
15
14
 
16
15
  ## Quick links
17
16
 
@@ -26,12 +25,12 @@
26
25
  - Internet: Email addresses, Passwords, Domains, etc.
27
26
  - Date and Time: Travel back in time or to the future.
28
27
  - Person: Names, Genders, Bios, Job titles, and more.
29
- - Number add String: Random numbers and strings.
28
+ - Number and String: Random numbers and strings.
30
29
  - Location: Addresses, Zip Codes, Street Names, States, and Countries.
31
30
  - Finance: Account Details, Transactions, and Crypto Addresses.
32
31
  - Localization - Customize faker with over 40 locales to generate realistic-looking Names, Addresses, and Phone Numbers.
33
32
 
34
- > **Note** The generated names, addresses, emails, phone numbers, and/or other data might return valid information. Please be careful when using faker in your tests.
33
+ > **Note:** The generated names, addresses, emails, phone numbers, and/or other data might return valid information. Please be careful when using faker in your tests.
35
34
 
36
35
  For a complete list of the generators, see [Generators](./GENERATORS.md).
37
36
 
@@ -104,8 +103,8 @@ Faker::Name.unique.clear # Clears used values for Faker::Name
104
103
  Faker::UniqueGenerator.clear # Clears used values for all generators
105
104
  ```
106
105
 
107
- You also can give some already used values to the unique generator if you have
108
- collisions with the generated data (i.e: using FactoryBot with random and
106
+ You can also give some already-used values to the unique generator if you have
107
+ collisions with the generated data (i.e., using FactoryBot with random and
109
108
  manually set values).
110
109
 
111
110
  ```ruby
@@ -153,11 +152,11 @@ check out the [locales README](lib/locales/README.md).
153
152
 
154
153
  ### Minitest and Faker >= 2.22
155
154
 
156
- To prevent Faker (version >= 2.22) from [generating duplicate values]((https://github.com/faker-ruby/faker/issues/2534)) when using Minitest,
155
+ To prevent Faker (version >= 2.22) from [generating duplicate values](https://github.com/faker-ruby/faker/issues/2534) when using Minitest,
157
156
  you might need to add the following to the `test_helper.rb` or `rails_helper.rb` file:
158
157
 
159
158
  ```ruby
160
- Faker::Config.random = Random.new
159
+ Faker::Config.random = Random.new
161
160
  ```
162
161
 
163
162
  ## Generators
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'openssl'
4
3
  require 'securerandom'
5
4
 
6
5
  module Faker
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'openssl'
4
3
  require 'securerandom'
5
4
 
6
5
  module Faker
@@ -37,7 +37,7 @@ module Faker
37
37
  #
38
38
  # @faker.version 1.4.3
39
39
  def image(slug: nil, size: '300x300', format: 'png', set: 'set1', bgset: nil)
40
- raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
40
+ raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /\A[0-9]+x[0-9]+\z/
41
41
  raise ArgumentError, "Supported formats are #{SUPPORTED_FORMATS.join(', ')}" unless SUPPORTED_FORMATS.include?(format)
42
42
 
43
43
  slug ||= Faker::Lorem.words.join
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'openssl'
4
-
5
3
  module Faker
6
4
  class Crypto < Base
7
5
  class << self
@@ -137,7 +137,7 @@ module Faker
137
137
  Faker::Number.number(digits: 2),
138
138
  Faker::Number.between(from: 13, to: 99),
139
139
  Faker::Number.between(from: 32, to: 99)
140
- ].map(&:to_s).join
140
+ ].join
141
141
 
142
142
  id_number = [
143
143
  invalid_date_of_birth,
@@ -96,7 +96,7 @@ module Faker
96
96
  private
97
97
 
98
98
  def build_url(size, format, search_terms, match_all)
99
- raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
99
+ raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /\A[0-9]+x[0-9]+\z/
100
100
 
101
101
  url_parts = ['https://loremflickr.com']
102
102
  url_parts << format
@@ -30,7 +30,7 @@ module Faker
30
30
  background_color = generate_color if background_color == :random
31
31
  text_color = generate_color if text_color == :random
32
32
 
33
- raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
33
+ raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /\A[0-9]+x[0-9]+\z$/
34
34
  raise ArgumentError, "Supported formats are #{SUPPORTED_FORMATS.join(', ')}" unless SUPPORTED_FORMATS.include?(format)
35
35
  raise ArgumentError, "background_color must be a hex value without '#'" unless background_color.nil? || background_color =~ /((?:^\h{3}$)|(?:^\h{6}$)){1}(?!.*\H)/
36
36
  raise ArgumentError, "text_color must be a hex value without '#'" unless text_color.nil? || text_color =~ /((?:^\h{3}$)|(?:^\h{6}$)){1}(?!.*\H)/
@@ -24,7 +24,7 @@ module Faker
24
24
  private
25
25
 
26
26
  def select_a(length)
27
- if length.class.included_modules.include? Enumerable
27
+ if length.class.include?(Enumerable)
28
28
  select_a sample(length.to_enum.to_a)
29
29
  else
30
30
  length # recursive base case
@@ -0,0 +1,189 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Faker
4
+ class X < Base
5
+ class << self
6
+ ##
7
+ # Produces a random X user based on X's v2 API.
8
+ #
9
+ # @return [Hash]
10
+ #
11
+ # @example
12
+ # Faker::X.user #=> { data: [{:id=>"8821452687517076614", :name=>"Lincoln Paucek", :screen_name=>"cody"...
13
+ #
14
+ # @faker.version 1.7.3
15
+ def user
16
+ author_id = Faker::Number.between(from: 1, to: 9_223_372_036_854_775_807)
17
+
18
+ {
19
+ data: [
20
+ {
21
+ author_id: author_id.to_s,
22
+ id: id.to_s,
23
+ text: Faker::Lorem.sentence
24
+ }
25
+ ],
26
+ includes: {
27
+ users: [
28
+ {
29
+ public_metrics: {
30
+ followers_count: Faker::Number.between(to: 1, from: 1_000),
31
+ following_count: Faker::Number.between(to: 1, from: 200),
32
+ tweet_count: Faker::Number.between(to: 1, from: 10_000),
33
+ listed_count: Faker::Number.between(to: 1, from: 1_000)
34
+ },
35
+ username: screen_name,
36
+ pinned_tweet_id: Faker::Number.between(from: 1, to: 9_223_372_036_854_775_807).to_s,
37
+ entities: user_entities,
38
+ description: Faker::Lorem.sentence,
39
+ name: Faker::Name.name,
40
+ verified: Faker::Boolean.boolean(true_ratio: 0.1),
41
+ location: Faker::Internet.public_ip_v4_address,
42
+ id: author_id.to_s,
43
+ protected: Faker::Boolean.boolean(true_ratio: 0.1),
44
+ url: url,
45
+ profile_image_url: Faker::Avatar.image(slug: id, size: '48x48'),
46
+ created_at: created_at
47
+ }
48
+ ]
49
+ }
50
+ }
51
+ end
52
+
53
+ ##
54
+ # Produces a random X tweet with default attributes.
55
+ #
56
+ # @param include_user [Boolean] Include user details
57
+ # @param include_media [Boolean] Include user media (photo) details
58
+ # @return [Hash]
59
+ #
60
+ # @example
61
+ # Faker::X.tweet #=> { data: [{:id=>"8821452687517076614", :text=>"Ea et laboriosam vel non."...
62
+ # Faker::X.tweet(include_media: true) # Get a tweet object with a photo media attachment
63
+ # Faker::X.tweet(include_user: true) # Get a tweet object with an user details
64
+ #
65
+ # @faker.version 1.7.3
66
+ def tweet(include_media: false, include_user: false)
67
+ tweet = {}
68
+ tweet_object = tweet_item
69
+ includes = {}
70
+
71
+ if include_media
72
+ media_key = Faker::Number.between(from: 1, to: 9_223_372_036_854_775_807).to_s
73
+
74
+ includes[:media] = media(media_key)
75
+ tweet_object[:attachments] = { media_keys: [media_key] }
76
+ end
77
+
78
+ includes[:users] = user[:includes][:users] if include_user
79
+
80
+ tweet[:data] = [
81
+ tweet_object
82
+ ]
83
+
84
+ unless includes.empty?
85
+ tweet[:includes] = includes
86
+ end
87
+
88
+ tweet
89
+ end
90
+
91
+ ##
92
+ # Produces a random screen_name.
93
+ #
94
+ # @return [String]
95
+ #
96
+ # @example
97
+ # Faker::X.screen_name #=> "audreanne_hackett"
98
+ #
99
+ # @faker.version 1.7.3
100
+ def screen_name
101
+ Faker::Internet.username(specifier: nil, separators: ['_'])[0...20]
102
+ end
103
+
104
+ private
105
+
106
+ def id
107
+ Faker::Number.between(from: 1, to: 9_223_372_036_854_775_807)
108
+ end
109
+
110
+ def created_at
111
+ Faker::Date.between(from: '2006-03-21', to: ::Date.today).to_time.utc.iso8601(3)
112
+ end
113
+
114
+ def url
115
+ "https://t.co/#{Faker::Lorem.characters(number: 10)}"
116
+ end
117
+
118
+ def user_entities
119
+ entities = tweet_entities
120
+
121
+ {
122
+ url: {
123
+ urls: entities[:urls]
124
+ },
125
+ description: {
126
+ hashtags: entities[:hashtags]
127
+ }
128
+ }
129
+ end
130
+
131
+ def tweet_entities
132
+ display_url = Faker::Internet.url(host: 'example.com')
133
+
134
+ {
135
+ urls: [
136
+ {
137
+ start: 0,
138
+ end: 5,
139
+ url: url,
140
+ expanded_url: display_url,
141
+ display_url: display_url.sub('http://', '')
142
+ }
143
+ ],
144
+ hashtags: [
145
+ {
146
+ start: 0,
147
+ end: 5,
148
+ tag: Faker::Lorem.word.capitalize
149
+ }
150
+ ]
151
+ }
152
+ end
153
+
154
+ def media(media_key)
155
+ expanded_url = Faker::LoremFlickr.image(size: '1064x600')
156
+
157
+ [{
158
+ height: Faker::Number.between(to: 1, from: 1000),
159
+ media_key: media_key,
160
+ type: 'photo',
161
+ preview_image_url: expanded_url,
162
+ width: Faker::Number.between(to: 1, from: 2000),
163
+ alt_text: Faker::Lorem.sentence
164
+ }]
165
+ end
166
+
167
+ def tweet_item
168
+ conversation_id = id.to_s
169
+
170
+ {
171
+ id: conversation_id,
172
+ text: Faker::Lorem.sentence,
173
+ lang: sample(%w[en fr es pt it ja]),
174
+ conversation_id: conversation_id,
175
+ created_at: created_at,
176
+ author_id: Faker::Number.between(from: 1, to: 9_223_372_036_854_775_807).to_s,
177
+ public_metrics: {
178
+ retweet_count: Faker::Number.between(to: 1, from: 100),
179
+ reply_count: Faker::Number.between(to: 1, from: 20),
180
+ like_count: Faker::Number.between(to: 1, from: 25),
181
+ quote_count: Faker::Number.between(to: 1, from: 10)
182
+ },
183
+ possibly_sensitive: Faker::Boolean.boolean(true_ratio: 0.1),
184
+ entities: tweet_entities
185
+ }
186
+ end
187
+ end
188
+ end
189
+ end
@@ -34,8 +34,4 @@ module Faker
34
34
  end
35
35
  end
36
36
  end
37
-
38
- include Faker::Deprecator
39
-
40
- deprecate_generator('BossaNova', Music::BossaNova)
41
37
  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.5.3'
4
+ VERSION = '3.6.1'
5
5
  end
data/lib/faker.rb CHANGED
@@ -5,6 +5,8 @@ mydir = __dir__
5
5
  require 'psych'
6
6
  require 'i18n'
7
7
 
8
+ autoload(:OpenSSL, 'openssl')
9
+
8
10
  Dir.glob(File.join(mydir, 'helpers', '*.rb')).each { |file| require file }
9
11
 
10
12
  I18n.load_path += Dir[File.join(mydir, 'locales', '**/*.yml')]
@@ -65,8 +67,8 @@ module Faker
65
67
  letterify(numerify(string))
66
68
  end
67
69
 
68
- def generate(as_type, &block)
69
- PositionalGenerator.new(as_type, &block).generate
70
+ def generate(as_type, &)
71
+ PositionalGenerator.new(as_type, &).generate
70
72
  end
71
73
 
72
74
  # Given a regular expression, attempt to generate a string
@@ -93,12 +95,12 @@ module Faker
93
95
  reg
94
96
  .gsub(%r{^/?\^?}, '').gsub(%r{\$?/?$}, '') # Ditch the anchors
95
97
  .gsub(/\{(\d+)\}/, '{\1,\1}').gsub('?', '{0,1}') # All {2} become {2,2} and ? become {0,1}
96
- .gsub(/(\[[^\]]+\])\{(\d+),(\d+)\}/) { |_match| Regexp.last_match(1) * sample(Array(Range.new(Regexp.last_match(2).to_i, Regexp.last_match(3).to_i))) } # [12]{1,2} becomes [12] or [12][12]
97
- .gsub(/(\([^)]+\))\{(\d+),(\d+)\}/) { |_match| Regexp.last_match(1) * sample(Array(Range.new(Regexp.last_match(2).to_i, Regexp.last_match(3).to_i))) } # (12|34){1,2} becomes (12|34) or (12|34)(12|34)
98
- .gsub(/(\\?.)\{(\d+),(\d+)\}/) { |_match| Regexp.last_match(1) * sample(Array(Range.new(Regexp.last_match(2).to_i, Regexp.last_match(3).to_i))) } # A{1,2} becomes A or AA or \d{3} becomes \d\d\d
99
- .gsub(/\((.*?)\)/) { |match| sample(match.gsub(/[()]/, '').split('|')) } # (this|that) becomes 'this' or 'that'
100
- .gsub(/\[([^\]]+)\]/) { |match| match.gsub(/(\w-\w)/) { |range| sample(Array(Range.new(*range.split('-')))) } } # All A-Z inside of [] become C (or X, or whatever)
101
- .gsub(/\[([^\]]+)\]/) { |_match| sample(Regexp.last_match(1).chars) } # All [ABC] become B (or A or C)
98
+ .gsub(/(\[[^\]]++\])\{(\d+),(\d+)\}/) { |_match| Regexp.last_match(1) * sample(Array(Range.new(Regexp.last_match(2).to_i, Regexp.last_match(3).to_i))) } # [12]{1,2} becomes [12] or [12][12]
99
+ .gsub(/(\([^)]++\))\{(\d+),(\d+)\}/) { |_match| Regexp.last_match(1) * sample(Array(Range.new(Regexp.last_match(2).to_i, Regexp.last_match(3).to_i))) } # (12|34){1,2} becomes (12|34) or (12|34)(12|34)
100
+ .gsub(/(\\?.)\{(\d+),(\d+)\}/) { |_match| Regexp.last_match(1) * sample(Array(Range.new(Regexp.last_match(2).to_i, Regexp.last_match(3).to_i))) } # A{1,2} becomes A or AA or \d{3} becomes \d\d\d
101
+ .gsub(/\((.*?)\)/) { |match| sample(match.gsub(/[()]/, '').split('|')) } # (this|that) becomes 'this' or 'that'
102
+ .gsub(/\[([^\]]++)\]/) { |match| match.gsub(/(\w-\w)/) { |range| sample(Array(Range.new(*range.split('-')))) } } # All A-Z inside of [] become C (or X, or whatever)
103
+ .gsub(/\[([^\]]++)\]/) { |_match| sample(Regexp.last_match(1).chars) } # All [ABC] become B (or A or C)
102
104
  .gsub('\d') { |_match| sample(Numbers) }
103
105
  .gsub('\w') { |_match| sample(Letters) }
104
106
  end
@@ -131,7 +133,8 @@ module Faker
131
133
  # formatted translation: e.g., "#{first_name} #{last_name}".
132
134
  def parse(key)
133
135
  fetched = fetch(key)
134
- parts = fetched.scan(/(\(?)#\{([A-Za-z]+\.)?([^}]+)\}([^#]+)?/).map do |prefix, kls, meth, etc|
136
+
137
+ parts = fetched.scan(/(\(?)#\{([A-Za-z]+\.)?([^}]+)\}([^#]++)?/).map do |prefix, kls, meth, etc|
135
138
  # If the token had a class Prefix (e.g., Name.first_name)
136
139
  # grab the constant, otherwise use self
137
140
  cls = kls ? Faker.const_get(kls.chop) : self
@@ -195,7 +198,7 @@ module Faker
195
198
  # name:
196
199
  # girls_name: ["Alice", "Cheryl", "Tatiana"]
197
200
  # Then you can call Faker::Name.girls_name and it will act like #first_name
198
- def method_missing(mth, *args, &block)
201
+ def method_missing(mth, *args, &)
199
202
  super unless flexible_key
200
203
 
201
204
  if (translation = translate("faker.#{flexible_key}.#{mth}"))
@@ -30,7 +30,7 @@ module Faker
30
30
  method_name.to_s.start_with?('faker_') || super
31
31
  end
32
32
 
33
- RetryLimitExceeded = Class.new(StandardError)
33
+ class RetryLimitExceeded < StandardError; end
34
34
 
35
35
  def previous_results
36
36
  Thread.current[:faker_unique_generator_previous_results] ||= {}
@@ -20,7 +20,7 @@ Faker::Hipster.word #=> "kogi"
20
20
 
21
21
  ## How to update a locale with more translations
22
22
 
23
- To update a locale with more translation features, simply add a new field to the .yml file that corresponds to an existing piece of functionality in the "en.yml" file. In this example, that would mean providing Chinese hipster words.
23
+ To update a locale with more translation features, simply add a new field to the `.yml` file that corresponds to an existing piece of functionality in the "en.yml" file. In this example, that would mean providing Chinese hipster words.
24
24
 
25
25
  ```yaml
26
26
  # /lib/locales/zh-CN.yml
@@ -52,5 +52,5 @@ Faker::Config.default_locale = :pt
52
52
  In threaded server environments, e.g., Puma, locale per thread can be set as the following:
53
53
 
54
54
  ```ruby
55
- Faker::Config.locale = :es
55
+ Faker::Config.locale = :es
56
56
  ```
data/lib/locales/ar.yml CHANGED
@@ -940,7 +940,8 @@ ar:
940
940
  - وأبناؤه
941
941
  - المحدودة
942
942
  buzzwords:
943
- - - حركات
943
+ -
944
+ - حركات
944
945
  - رهيب
945
946
  - بعد نظر
946
947
  - تقنية
@@ -988,7 +989,8 @@ ar:
988
989
  - قراءة
989
990
  - مبهر
990
991
  bs:
991
- - - ينفّذ
992
+ -
993
+ - ينفّذ
992
994
  - ينفع
993
995
  - يدمج
994
996
  - يحسّن
@@ -1025,7 +1027,8 @@ ar:
1025
1027
  - يزرع
1026
1028
  - ينتج
1027
1029
  - يعيد تعريف
1028
- - - نقرات وقذائف
1030
+ -
1031
+ - نقرات وقذائف
1029
1032
  - قيمة مضافة
1030
1033
  - عمودي
1031
1034
  - استباقي
@@ -1066,7 +1069,8 @@ ar:
1066
1069
  - مخصّص
1067
1070
  - متعاون
1068
1071
  - غنيّ
1069
- - - القابضة
1072
+ -
1073
+ - القابضة
1070
1074
  - نماذج
1071
1075
  - الأسواق
1072
1076
  - الشراكات