faker 2.11.0 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +421 -13
  3. data/History.md +4 -4
  4. data/README.md +33 -3
  5. data/lib/faker.rb +28 -23
  6. data/lib/faker/blockchain/aeternity.rb +4 -4
  7. data/lib/faker/blockchain/bitcoin.rb +2 -2
  8. data/lib/faker/blockchain/tezos.rb +30 -2
  9. data/lib/faker/books/dune.rb +15 -2
  10. data/lib/faker/books/lovecraft.rb +8 -4
  11. data/lib/faker/creature/bird.rb +203 -0
  12. data/lib/faker/default/address.rb +35 -5
  13. data/lib/faker/default/app.rb +1 -1
  14. data/lib/faker/default/avatar.rb +1 -1
  15. data/lib/faker/default/bank.rb +96 -3
  16. data/lib/faker/default/barcode.rb +165 -0
  17. data/lib/faker/default/beer.rb +3 -3
  18. data/lib/faker/default/blood.rb +48 -0
  19. data/lib/faker/default/business.rb +1 -1
  20. data/lib/faker/default/camera.rb +46 -0
  21. data/lib/faker/default/cannabis.rb +10 -0
  22. data/lib/faker/default/chile_rut.rb +47 -3
  23. data/lib/faker/default/chuck_norris.rb +1 -0
  24. data/lib/faker/default/code.rb +98 -17
  25. data/lib/faker/default/commerce.rb +74 -11
  26. data/lib/faker/default/company.rb +96 -11
  27. data/lib/faker/default/compass.rb +135 -0
  28. data/lib/faker/default/computer.rb +63 -0
  29. data/lib/faker/default/construction.rb +54 -0
  30. data/lib/faker/default/cosmere.rb +90 -0
  31. data/lib/faker/default/crypto.rb +17 -4
  32. data/lib/faker/default/crypto_coin.rb +45 -0
  33. data/lib/faker/default/date.rb +16 -12
  34. data/lib/faker/default/driving_licence.rb +67 -1
  35. data/lib/faker/default/drone.rb +332 -0
  36. data/lib/faker/default/educator.rb +13 -0
  37. data/lib/faker/default/faker_adjective.rb +35 -0
  38. data/lib/faker/default/file.rb +53 -2
  39. data/lib/faker/default/finance.rb +45 -0
  40. data/lib/faker/default/food.rb +1 -1
  41. data/lib/faker/default/gender.rb +1 -1
  42. data/lib/faker/default/hipster.rb +107 -10
  43. data/lib/faker/default/id_number.rb +122 -2
  44. data/lib/faker/default/internet.rb +266 -12
  45. data/lib/faker/default/internet_http.rb +48 -0
  46. data/lib/faker/default/invoice.rb +33 -6
  47. data/lib/faker/default/json.rb +61 -5
  48. data/lib/faker/default/lorem.rb +160 -5
  49. data/lib/faker/default/lorem_flickr.rb +67 -7
  50. data/lib/faker/default/lorem_pixel.rb +23 -0
  51. data/lib/faker/default/markdown.rb +91 -0
  52. data/lib/faker/default/measurement.rb +93 -2
  53. data/lib/faker/default/military.rb +26 -0
  54. data/lib/faker/default/mountain.rb +33 -0
  55. data/lib/faker/default/name.rb +98 -0
  56. data/lib/faker/default/nhs.rb +19 -0
  57. data/lib/faker/default/number.rb +28 -13
  58. data/lib/faker/default/omniauth.rb +62 -14
  59. data/lib/faker/default/phone_number.rb +88 -5
  60. data/lib/faker/default/placeholdit.rb +23 -1
  61. data/lib/faker/default/relationship.rb +1 -1
  62. data/lib/faker/default/science.rb +26 -0
  63. data/lib/faker/default/slack_emoji.rb +81 -0
  64. data/lib/faker/default/south_africa.rb +90 -0
  65. data/lib/faker/default/space.rb +1 -1
  66. data/lib/faker/default/string.rb +20 -3
  67. data/lib/faker/default/stripe.rb +64 -3
  68. data/lib/faker/default/tea.rb +41 -0
  69. data/lib/faker/default/twitter.rb +35 -0
  70. data/lib/faker/default/types.rb +84 -3
  71. data/lib/faker/default/university.rb +45 -0
  72. data/lib/faker/default/vehicle.rb +184 -4
  73. data/lib/faker/default/verb.rb +45 -0
  74. data/lib/faker/default/world_cup.rb +4 -4
  75. data/lib/faker/fantasy/tolkien.rb +67 -0
  76. data/lib/faker/games/clash_of_clans.rb +48 -0
  77. data/lib/faker/games/control.rb +113 -0
  78. data/lib/faker/games/dnd.rb +136 -0
  79. data/lib/faker/games/elder_scrolls.rb +26 -0
  80. data/lib/faker/games/heroes.rb +13 -0
  81. data/lib/faker/games/heroes_of_the_storm.rb +16 -5
  82. data/lib/faker/games/minecraft.rb +113 -0
  83. data/lib/faker/games/street_fighter.rb +61 -0
  84. data/lib/faker/games/super_mario.rb +48 -0
  85. data/lib/faker/games/touhou.rb +75 -0
  86. data/lib/faker/games/warhammer_fantasy.rb +74 -0
  87. data/lib/faker/games/witcher.rb +39 -0
  88. data/lib/faker/games/world_of_warcraft.rb +26 -1
  89. data/lib/faker/japanese_media/conan.rb +48 -0
  90. data/lib/faker/japanese_media/doraemon.rb +48 -0
  91. data/lib/faker/japanese_media/dragon_ball.rb +26 -0
  92. data/lib/faker/japanese_media/naruto.rb +61 -0
  93. data/lib/faker/japanese_media/studio_ghibli.rb +48 -0
  94. data/lib/faker/movies/departed.rb +49 -0
  95. data/lib/faker/movies/hobbit.rb +4 -4
  96. data/lib/faker/movies/how_to_train_your_dragon.rb +48 -0
  97. data/lib/faker/movies/lord_of_the_rings.rb +3 -3
  98. data/lib/faker/movies/movie.rb +13 -0
  99. data/lib/faker/movies/room.rb +63 -0
  100. data/lib/faker/movies/star_wars.rb +74 -2
  101. data/lib/faker/music/hiphop.rb +48 -0
  102. data/lib/faker/music/music.rb +12 -0
  103. data/lib/faker/music/opera.rb +237 -1
  104. data/lib/faker/music/pearl_jam.rb +50 -0
  105. data/lib/faker/music/phish.rb +27 -1
  106. data/lib/faker/music/prince.rb +64 -0
  107. data/lib/faker/music/rock_band.rb +12 -0
  108. data/lib/faker/music/rush.rb +37 -0
  109. data/lib/faker/music/show.rb +49 -0
  110. data/lib/faker/quotes/quote.rb +80 -1
  111. data/lib/faker/quotes/rajnikanth.rb +1 -0
  112. data/lib/faker/quotes/shakespeare.rb +70 -0
  113. data/lib/faker/sports/volleyball.rb +74 -0
  114. data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +13 -0
  115. data/lib/faker/tv_shows/big_bang_theory.rb +37 -0
  116. data/lib/faker/tv_shows/buffy.rb +17 -4
  117. data/lib/faker/tv_shows/dr_who.rb +1 -1
  118. data/lib/faker/tv_shows/final_space.rb +51 -0
  119. data/lib/faker/tv_shows/futurama.rb +65 -0
  120. data/lib/faker/tv_shows/simpsons.rb +14 -0
  121. data/lib/faker/tv_shows/suits.rb +37 -0
  122. data/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb +17 -4
  123. data/lib/faker/version.rb +1 -1
  124. data/lib/helpers/base58.rb +1 -1
  125. data/lib/helpers/char.rb +22 -27
  126. data/lib/helpers/unique_generator.rb +0 -2
  127. data/lib/locales/de-AT.yml +4 -2
  128. data/lib/locales/de-CH.yml +1696 -1
  129. data/lib/locales/de.yml +4 -2
  130. data/lib/locales/en-AU.yml +50 -10
  131. data/lib/locales/en-CA.yml +2 -0
  132. data/lib/locales/en-GB.yml +1 -1
  133. data/lib/locales/en-IND.yml +2 -1
  134. data/lib/locales/en-MS.yml +2 -1
  135. data/lib/locales/en-NEP.yml +4 -1
  136. data/lib/locales/en-NZ.yml +3 -1
  137. data/lib/locales/en-PAK.yml +2 -1
  138. data/lib/locales/en-SG.yml +2 -1
  139. data/lib/locales/en-US.yml +37 -11
  140. data/lib/locales/en-au-ocker.yml +2 -1
  141. data/lib/locales/en.yml +0 -3
  142. data/lib/locales/en/address.yml +2 -0
  143. data/lib/locales/en/adjective.yml +179 -0
  144. data/lib/locales/en/animal.yml +1 -1
  145. data/lib/locales/en/aqua_teen_hunger_force.yml +33 -1
  146. data/lib/locales/en/bank.yml +1 -1
  147. data/lib/locales/en/barcode.yml +24 -0
  148. data/lib/locales/en/big_bang_theory.yml +38 -0
  149. data/lib/locales/en/bird.yml +1281 -0
  150. data/lib/locales/en/blood.yml +13 -0
  151. data/lib/locales/en/book.yml +487 -3
  152. data/lib/locales/en/buffy.yml +1 -1
  153. data/lib/locales/en/camera.yml +611 -0
  154. data/lib/locales/en/clash_of_clan.yml +101 -0
  155. data/lib/locales/en/company.yml +2 -2
  156. data/lib/locales/en/computer.yml +36 -0
  157. data/lib/locales/en/conan.yml +171 -0
  158. data/lib/locales/en/control.yml +247 -0
  159. data/lib/locales/en/demographic.yml +218 -5
  160. data/lib/locales/en/departed.yml +50 -0
  161. data/lib/locales/en/device.yml +112 -4
  162. data/lib/locales/en/dnd.yml +451 -0
  163. data/lib/locales/en/doraemon.yml +286 -0
  164. data/lib/locales/en/dota.yml +531 -63
  165. data/lib/locales/en/dragon_ball.yml +243 -1
  166. data/lib/locales/en/driving_license.yml +181 -0
  167. data/lib/locales/en/drone.yml +95 -0
  168. data/lib/locales/en/dune.yml +270 -131
  169. data/lib/locales/en/educator.yml +6 -0
  170. data/lib/locales/en/elder_scrolls.yml +583 -9
  171. data/lib/locales/en/fallout.yml +311 -133
  172. data/lib/locales/en/final_space.yml +37 -0
  173. data/lib/locales/en/finance.yml +53 -0
  174. data/lib/locales/en/football.yml +3 -3
  175. data/lib/locales/en/fresh_prince_of_bel_air.yml +1 -1
  176. data/lib/locales/en/futurama.yml +344 -0
  177. data/lib/locales/en/half_life.yml +84 -3
  178. data/lib/locales/en/heroes.yml +408 -3
  179. data/lib/locales/en/heroes_of_the_storm.yml +131 -4
  180. data/lib/locales/en/house.yml +1 -1
  181. data/lib/locales/en/how_to_train_your_dragon.yml +174 -0
  182. data/lib/locales/en/jack_handey.yml +54 -0
  183. data/lib/locales/en/league_of_legends.yml +285 -6
  184. data/lib/locales/en/lebowski.yml +1 -1
  185. data/lib/locales/en/lovecraft.yml +76 -6
  186. data/lib/locales/en/military.yml +179 -5
  187. data/lib/locales/en/minecraft.yml +663 -0
  188. data/lib/locales/en/mountain.yml +158 -0
  189. data/lib/locales/en/movie.yml +192 -1
  190. data/lib/locales/en/music.yml +461 -29
  191. data/lib/locales/en/myst.yml +87 -31
  192. data/lib/locales/en/name.yml +5 -4
  193. data/lib/locales/en/naruto.yml +231 -0
  194. data/lib/locales/en/one_piece.yml +2 -2
  195. data/lib/locales/en/opera.yml +168 -0
  196. data/lib/locales/en/overwatch.yml +2650 -2622
  197. data/lib/locales/en/pearl_jam.yml +213 -0
  198. data/lib/locales/en/phish.yml +392 -1
  199. data/lib/locales/en/pokemon.yml +417 -4
  200. data/lib/locales/en/prince.yml +227 -0
  201. data/lib/locales/en/quote.yml +692 -163
  202. data/lib/locales/en/rock_band.yml +1 -0
  203. data/lib/locales/en/room.yml +68 -0
  204. data/lib/locales/en/rush.yml +32 -0
  205. data/lib/locales/en/science.yml +355 -3
  206. data/lib/locales/en/shakespeare.yml +21 -24
  207. data/lib/locales/en/show.yml +597 -0
  208. data/lib/locales/en/simpsons.yml +668 -0
  209. data/lib/locales/en/source.yml +30 -0
  210. data/lib/locales/en/space.yml +1 -1
  211. data/lib/locales/en/star_trek.yml +1 -1
  212. data/lib/locales/en/star_wars.yml +568 -220
  213. data/lib/locales/en/street_fighter.yml +1524 -0
  214. data/lib/locales/en/studio_ghibli.yml +107 -0
  215. data/lib/locales/en/suits.yml +45 -0
  216. data/lib/locales/en/super_mario.yml +58 -0
  217. data/lib/locales/en/super_smash_bros.yml +18 -4
  218. data/lib/locales/en/tea.yml +172 -0
  219. data/lib/locales/en/tolkien.yml +2453 -0
  220. data/lib/locales/en/touhou.yml +839 -0
  221. data/lib/locales/en/volleyball.yml +501 -0
  222. data/lib/locales/en/warhammer_fantasy.yml +582 -0
  223. data/lib/locales/en/witcher.yml +426 -7
  224. data/lib/locales/en/world_of_warcraft.yml +122 -4
  225. data/lib/locales/en/zelda.yml +962 -4
  226. data/lib/locales/es-AR.yml +4603 -0
  227. data/lib/locales/es.yml +56 -0
  228. data/lib/locales/fi-FI.yml +1 -1
  229. data/lib/locales/fr-CA.yml +21 -5
  230. data/lib/locales/fr-CH.yml +2 -2
  231. data/lib/locales/fr.yml +1 -113
  232. data/lib/locales/fr/address.yml +21 -0
  233. data/lib/locales/fr/book.yml +7 -0
  234. data/lib/locales/fr/color.yml +4 -0
  235. data/lib/locales/fr/company.yml +17 -0
  236. data/lib/locales/fr/compass.yml +23 -0
  237. data/lib/locales/fr/demographic.yml +4 -0
  238. data/lib/locales/fr/gender.yml +6 -0
  239. data/lib/locales/fr/internet.yml +5 -0
  240. data/lib/locales/fr/lorem.yml +5 -0
  241. data/lib/locales/fr/measurement.yml +7 -0
  242. data/lib/locales/fr/name.yml +21 -0
  243. data/lib/locales/fr/phone_number.yml +7 -0
  244. data/lib/locales/fr/pokemon.yml +9 -0
  245. data/lib/locales/id.yml +3 -1
  246. data/lib/locales/it.yml +2 -1
  247. data/lib/locales/ja/README.md +13 -0
  248. data/lib/locales/ja/address.yml +17 -0
  249. data/lib/locales/ja/ancient.yml +4 -0
  250. data/lib/locales/ja/bank.yml +4 -0
  251. data/lib/locales/ja/book.yml +7 -0
  252. data/lib/locales/ja/coffee.yml +4 -0
  253. data/lib/locales/ja/color.yml +4 -0
  254. data/lib/locales/ja/commerce.yml +11 -0
  255. data/lib/locales/ja/company.yml +8 -0
  256. data/lib/locales/ja/creature.yml +9 -0
  257. data/lib/locales/ja/food.yml +4 -0
  258. data/lib/locales/ja/games.yml +18 -0
  259. data/lib/locales/ja/gender.yml +4 -0
  260. data/lib/locales/ja/lorem.yml +9 -0
  261. data/lib/locales/ja/name.yml +13 -0
  262. data/lib/locales/ja/phone_number.yml +7 -0
  263. data/lib/locales/ja/restaurant.yml +11 -0
  264. data/lib/locales/ja/space.yml +5 -0
  265. data/lib/locales/ja/subscription.yml +8 -0
  266. data/lib/locales/ja/university.yml +9 -0
  267. data/lib/locales/ko.yml +94 -2
  268. data/lib/locales/nb-NO.yml +4 -2
  269. data/lib/locales/pt-BR.yml +3 -1
  270. data/lib/locales/pt.yml +3 -1
  271. data/lib/locales/ru.yml +42 -1
  272. data/lib/locales/sk.yml +4 -2
  273. data/lib/locales/uk.yml +2 -0
  274. metadata +133 -24
  275. data/lib/locales/en/hobbit.yml +0 -19
  276. data/lib/locales/en/lord_of_the_rings.yml +0 -6
  277. data/lib/locales/ja.yml +0 -101
data/History.md CHANGED
@@ -33,7 +33,7 @@
33
33
  ## v1.6.0 (2015-11-23)
34
34
  * Lots of bug fixes -- most notably, a fix for email addresses and domains in non-en locales
35
35
  * Updated locales: de, en-AU, en-NZ, en-SG, en-US, en-au-ocker, en, es, fr, he, it, ja, nb-NO, pl, pt-BR, sk, and zh-CN
36
- * Updated classes: Address, Avatar, Book, Code, Commerce, Company, Hipster, IDNumber, Internet, Number, Placeholdit, Shakespeare, and Time
36
+ * Updated classes: Address, Avatar, Book, Code, Commerce, Company, Hipster, IDNumber, Internet, Number, Placeholdit, Shakespeare, and Time
37
37
 
38
38
  ## v1.5.0 (2015-08-17)
39
39
  * Added logos
@@ -83,7 +83,7 @@
83
83
  * 1 major change:
84
84
  * Removed deprecated methods from Address: earth_country, us_state, us_state_abbr, uk_postcode, uk_county
85
85
  * Many minor changes (please see github pull requests for credits)
86
- * Added many localizations
86
+ * Added many localizations
87
87
  * Added range and array support for Lorem
88
88
 
89
89
  ## v1.0.1 (2011-09-27)
@@ -117,7 +117,7 @@
117
117
  * Added Canadian translation [igbanam]
118
118
  * Added Norwegian translation [kytrinyx]
119
119
  * Lots of translation-related cleanup [kytrinyx]
120
-
120
+
121
121
 
122
122
  ## v0.9.5 (2011-01-27)
123
123
  * 1 minor bug fix:
@@ -159,7 +159,7 @@
159
159
  * 3 major enhancements:
160
160
  * Added Lorem to generate fake Latin
161
161
  * Added secondary_address to Address, and made inclusion of
162
- secondary address in street_address optional (false by
162
+ secondary address in street_address optional (false by
163
163
  default).
164
164
  * Added UK address methods [Caius Durling]
165
165
 
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
-
2
1
  ![logotype a happy-07](https://user-images.githubusercontent.com/36028424/40263395-4318481e-5b44-11e8-92e5-3dcc1ce169b3.png)
3
2
 
4
3
  # Faker
5
- [![Build Status](https://travis-ci.org/faker-ruby/faker.svg?branch=master)](https://travis-ci.org/faker-ruby/faker)
4
+ [![Tests](https://github.com/faker-ruby/faker/workflows/Tests/badge.svg)](https://github.com/faker-ruby/faker/actions?query=workflow%3ATests)
6
5
  [![Gem Version](https://badge.fury.io/rb/faker.svg)](https://badge.fury.io/rb/faker)
7
6
  [![Inline docs](https://inch-ci.org/github/faker-ruby/faker.svg?branch=master)](https://inch-ci.org/github/faker-ruby/faker)
8
7
  [![Test Coverage](https://api.codeclimate.com/v1/badges/ef54c7f9df86e965d64b/test_coverage)](https://codeclimate.com/github/stympy/faker/test_coverage)
@@ -28,6 +27,7 @@ development.
28
27
  - [Default](#default)
29
28
  - [Blockchain](#blockchain)
30
29
  - [Books](#books)
30
+ - [Fantasy](#fantasy)
31
31
  - [Creature](#creature)
32
32
  - [Games](#games)
33
33
  - [Japanese Media](#japanese-media)
@@ -95,7 +95,7 @@ manually set values).
95
95
  # Faker::<generator>.unique.exclude(method, arguments, list)
96
96
 
97
97
  # Add 'azerty' and 'wxcvbn' to the string generator with 6 char length
98
- Faker::Lorem.unique.exclude :string, [6], %w[azerty wxcvbn]
98
+ Faker::Lorem.unique.exclude :string, [number: 6], %w[azerty wxcvbn]
99
99
  ```
100
100
 
101
101
  ### Deterministic Random
@@ -130,7 +130,9 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
130
130
  - [Faker::Artist](doc/default/artist.md)
131
131
  - [Faker::Avatar](doc/default/avatar.md)
132
132
  - [Faker::Bank](doc/default/bank.md)
133
+ - [Faker::Barcode](doc/default/barcode.md)
133
134
  - [Faker::Beer](doc/default/beer.md)
135
+ - [Faker::Blood](doc/default/blood.md)
134
136
  - [Faker::Boolean](doc/default/boolean.md)
135
137
  - [Faker::BossaNova](doc/default/bossa_nova.md)
136
138
  - [Faker::Business](doc/default/business.md)
@@ -144,6 +146,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
144
146
  - [Faker::Commerce](doc/default/commerce.md)
145
147
  - [Faker::Company](doc/default/company.md)
146
148
  - [Faker::Compass](doc/default/compass.md)
149
+ - [Faker::Computer](doc/default/computer.md)
147
150
  - [Faker::Construction](doc/default/construction.md)
148
151
  - [Faker::Cosmere](doc/default/cosmere.md)
149
152
  - [Faker::Crypto](doc/default/crypto.md)
@@ -155,6 +158,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
155
158
  - [Faker::Dessert](doc/default/dessert.md)
156
159
  - [Faker::Device](doc/default/device.md)
157
160
  - [Faker::DrivingLicence](doc/default/driving_licence.md)
161
+ - [Faker::Drone](doc/drone/drone.md)
158
162
  - [Faker::Educator](doc/default/educator.md)
159
163
  - [Faker::ElectricalComponents](doc/default/electrical_components.md)
160
164
  - [Faker::Esport](doc/default/esport.md)
@@ -182,6 +186,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
182
186
  - [Faker::Marketing](doc/default/marketing.md)
183
187
  - [Faker::Measurement](doc/default/measurement.md)
184
188
  - [Faker::Military](doc/default/military.md)
189
+ - [Faker::Mountain](doc/default/mountain.md)
185
190
  - [Faker::Name](doc/default/name.md)
186
191
  - [Faker::Nation](doc/default/nation.md)
187
192
  - [Faker::NatoPhoneticAlphabet](doc/default/nato_phonetic_alphabet.md)
@@ -202,6 +207,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
202
207
  - [Faker::Stripe](doc/default/stripe.md)
203
208
  - [Faker::Subscription](doc/default/subscription.md)
204
209
  - [Faker::Superhero](doc/default/superhero.md)
210
+ - [Faker::Tea](doc/default/tea.md)
205
211
  - [Faker::Team](doc/default/team.md)
206
212
  - [Faker::Time](doc/default/time.md)
207
213
  - [Faker::Twitter](doc/default/twitter.md)
@@ -223,14 +229,20 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
223
229
  - [Faker::Books::Dune](doc/books/dune.md)
224
230
  - [Faker::Books::Lovecraft](doc/books/lovecraft.md)
225
231
 
232
+ ### Fantasy
233
+ - [Faker::Fantasy::Tolkien](doc/fantasy/tolkien.md)
234
+
226
235
  ### Creature
227
236
  - [Faker::Creature::Animal](doc/creature/animal.md)
237
+ - [Faker::Creature::Bird](doc/creature/bird.md)
228
238
  - [Faker::Creature::Cat](doc/creature/cat.md)
229
239
  - [Faker::Creature::Dog](doc/creature/dog.md)
230
240
  - [Faker::Creature::Horse](doc/creature/horse.md)
231
241
 
232
242
  ### Games
233
243
  - [Faker::Game](doc/games/game.md)
244
+ - [Faker::Games::ClashOfClans](doc/games/clash_of_clans.md)
245
+ - [Faker::Games::DnD](doc/games/dnd.md)
234
246
  - [Faker::Games::Dota](doc/games/dota.md)
235
247
  - [Faker::Games::ElderScrolls](doc/games/elder_scrolls.md)
236
248
  - [Faker::Games::Fallout](doc/games/fallout.md)
@@ -238,11 +250,16 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
238
250
  - [Faker::Games::Heroes](doc/games/heroes.md)
239
251
  - [Faker::Games::HeroesOfTheStorm](doc/games/heroes_of_the_storm.md)
240
252
  - [Faker::Games::LeagueOfLegends](doc/games/league_of_legends.md)
253
+ - [Faker::Games::Minecraft](doc/games/minecraft.md)
241
254
  - [Faker::Games::Myst](doc/games/myst.md)
242
255
  - [Faker::Games::Overwatch](doc/games/overwatch.md)
243
256
  - [Faker::Games::Pokemon](doc/games/pokemon.md)
244
257
  - [Faker::Games::SonicTheHedgehog](doc/games/sonic_the_hedgehog.md)
258
+ - [Faker::Games::StreetFighter](doc/games/street_fighter.md)
259
+ - [Faker::Games::SuperMario](doc/games/super_mario.md)
245
260
  - [Faker::Games::SuperSmashBros](doc/games/super_smash_bros.md)
261
+ - [Faker::Games::Touhou](doc/games/touhou.md)
262
+ - [Faker::Games::WarhammerFantasy](doc/games/warhammer_fantasy.md)
246
263
  - [Faker::Games::Witcher](doc/games/witcher.md)
247
264
  - [Faker::Games::WorldOfWarcraft](doc/games/world_of_warcraft.md)
248
265
  - [Faker::Games::Zelda](doc/games/zelda.md)
@@ -250,15 +267,21 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
250
267
  ### Japanese Media
251
268
  - [Faker::JapaneseMedia::DragonBall](doc/japanese_media/dragon_ball.md)
252
269
  - [Faker::JapaneseMedia::OnePiece](doc/japanese_media/one_piece.md)
270
+ - [Faker::JapaneseMedia::StudioGhibli](doc/japanese_media/studio_ghibli.md)
253
271
  - [Faker::JapaneseMedia::SwordArtOnline](doc/japanese_media/sword_art_online.md)
272
+ - [Faker::JapaneseMedia::Naruto](doc/japanese_media/naruto.md)
273
+ - [Faker::JapaneseMedia::Doraemon](doc/japanese_media/doraemon.md)
274
+ - [Faker::JapaneseMedia::Conan](doc/japanese_media/conan.md)
254
275
 
255
276
  ### Movies
256
277
  - [Faker::Movie](doc/movies/movie.md)
257
278
  - [Faker::Movies::BackToTheFuture](doc/movies/back_to_the_future.md)
279
+ - [Faker::Movies::Departed](doc/movies/departed.md)
258
280
  - [Faker::Movies::Ghostbusters](doc/movies/ghostbusters.md)
259
281
  - [Faker::Movies::HarryPotter](doc/movies/harry_potter.md)
260
282
  - [Faker::Movies::HitchhikersGuideToTheGalaxy](doc/movies/hitchhikers_guide_to_the_galaxy.md)
261
283
  - [Faker::Movies::Hobbit](doc/movies/hobbit.md)
284
+ - [Faker::Movies::HowToTrainYourDragon](doc/movies/how_to_train_your_dragon.md)
262
285
  - [Faker::Movies::Lebowski](doc/movies/lebowski.md)
263
286
  - [Faker::Movies::LordOfTheRings](doc/movies/lord_of_the_rings.md)
264
287
  - [Faker::Movies::PrincessBride](doc/movies/princess_bride.md)
@@ -268,9 +291,13 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
268
291
  ### Music
269
292
  - [Faker::Music](doc/music/music.md)
270
293
  - [Faker::Music::GratefulDead](doc/music/grateful_dead.md)
294
+ - [Faker::Music::Hiphop](doc/music/hiphop.md)
271
295
  - [Faker::Music::Opera](doc/music/opera.md)
296
+ - [Faker::Music::PearlJam](doc/music/pearl_jam.md)
272
297
  - [Faker::Music::Phish](doc/music/phish.md)
298
+ - [Faker::Music::Prince](doc/music/prince.md)
273
299
  - [Faker::Music::RockBand](doc/music/rock_band.md)
300
+ - [Faker::Music::Rush](doc/music/rush.md)
274
301
  - [Faker::Music::UmphreysMcgee](doc/music/umphreys_mcgee.md)
275
302
 
276
303
  ### Quotes
@@ -286,6 +313,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
286
313
 
287
314
  ### Tv Shows
288
315
  - [Faker::TvShows::AquaTeenHungerForce](doc/tv_shows/aqua_teen_hunger_force.md)
316
+ - [Faker::TvShows::BigBangTheory](doc/tv_shows/big_bang_theory.md)
289
317
  - [Faker::TvShows::BojackHorseman](doc/tv_shows/bojack_horseman.md)
290
318
  - [Faker::TvShows::BreakingBad](doc/tv_shows/breaking_bad.md)
291
319
  - [Faker::TvShows::Buffy](doc/tv_shows/buffy.md)
@@ -293,6 +321,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
293
321
  - [Faker::TvShows::DrWho](doc/tv_shows/dr_who.md)
294
322
  - [Faker::TvShows::DumbAndDumber](doc/tv_shows/dumb_and_dumber.md)
295
323
  - [Faker::TvShows::FamilyGuy](doc/tv_shows/family_guy.md)
324
+ - [Faker::TvShows::FinalSpace](doc/tv_shows/final_space.md)
296
325
  - [Faker::TvShows::Friends](doc/tv_shows/friends.md)
297
326
  - [Faker::TvShows::GameOfThrones](doc/tv_shows/game_of_thrones.md)
298
327
  - [Faker::TvShows::HeyArnold](doc/tv_shows/hey_arnold.md)
@@ -309,6 +338,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
309
338
  - [Faker::TvShows::StarTrek](doc/tv_shows/star_trek.md)
310
339
  - [Faker::TvShows::Stargate](doc/tv_shows/stargate.md)
311
340
  - [Faker::TvShows::StrangerThings](doc/tv_shows/stranger_things.md)
341
+ - [Faker::TvShows::Suits](doc/tv_shows/suits.md)
312
342
  - [Faker::TvShows::TheExpanse](doc/tv_shows/the_expanse.md)
313
343
  - [Faker::TvShows::TheFreshPrinceOfBelAir](doc/tv_shows/the_fresh_prince_of_bel_air.md)
314
344
  - [Faker::TvShows::TheITCrowd](doc/tv_shows/the_it_crowd.md)
data/lib/faker.rb CHANGED
@@ -2,29 +2,26 @@
2
2
 
3
3
  mydir = __dir__
4
4
 
5
- begin
6
- require 'psych'
7
- end
8
-
5
+ require 'psych'
9
6
  require 'i18n'
10
7
  require 'set' # Fixes a bug in i18n 0.6.11
11
8
 
12
- Dir.glob(File.join(File.dirname(__FILE__), 'helpers', '*.rb')).sort.each { |file| require file }
9
+ Dir.glob(File.join(mydir, 'helpers', '*.rb')).sort.each { |file| require file }
13
10
 
14
11
  I18n.load_path += Dir[File.join(mydir, 'locales', '**/*.yml')]
15
12
  I18n.reload! if I18n.backend.initialized?
16
13
 
17
14
  module Faker
18
- class Config
15
+ module Config
19
16
  @locale = nil
20
17
  @random = nil
21
18
 
22
19
  class << self
23
- attr_writer :locale
24
- attr_writer :random
20
+ attr_writer :locale, :random
25
21
 
26
22
  def locale
27
- @locale || I18n.locale
23
+ # Because I18n.locale defaults to :en, if we don't have :en in our available_locales, errors will happen
24
+ @locale || (I18n.available_locales.include?(I18n.locale) ? I18n.locale : I18n.available_locales.first)
28
25
  end
29
26
 
30
27
  def own_locale
@@ -32,7 +29,7 @@ module Faker
32
29
  end
33
30
 
34
31
  def random
35
- @random || Random::DEFAULT
32
+ @random || Random.new
36
33
  end
37
34
  end
38
35
  end
@@ -83,13 +80,13 @@ module Faker
83
80
  def regexify(reg)
84
81
  reg = reg.source if reg.respond_to?(:source) # Handle either a Regexp or a String that looks like a Regexp
85
82
  reg
86
- .gsub(%r{^\/?\^?}, '').gsub(%r{\$?\/?$}, '') # Ditch the anchors
83
+ .gsub(%r{^/?\^?}, '').gsub(%r{\$?/?$}, '') # Ditch the anchors
87
84
  .gsub(/\{(\d+)\}/, '{\1,\1}').gsub(/\?/, '{0,1}') # All {2} become {2,2} and ? become {0,1}
88
85
  .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]
89
- .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)
86
+ .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)
90
87
  .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
91
- .gsub(/\((.*?)\)/) { |match| sample(match.gsub(/[\(\)]/, '').split('|')) } # (this|that) becomes 'this' or 'that'
92
- .gsub(/\[([^\]]+)\]/) { |match| match.gsub(/(\w\-\w)/) { |range| sample(Array(Range.new(*range.split('-')))) } } # All A-Z inside of [] become C (or X, or whatever)
88
+ .gsub(/\((.*?)\)/) { |match| sample(match.gsub(/[()]/, '').split('|')) } # (this|that) becomes 'this' or 'that'
89
+ .gsub(/\[([^\]]+)\]/) { |match| match.gsub(/(\w-\w)/) { |range| sample(Array(Range.new(*range.split('-')))) } } # All A-Z inside of [] become C (or X, or whatever)
93
90
  .gsub(/\[([^\]]+)\]/) { |_match| sample(Regexp.last_match(1).split('')) } # All [ABC] become B (or A or C)
94
91
  .gsub('\d') { |_match| sample(Numbers) }
95
92
  .gsub('\w') { |_match| sample(Letters) }
@@ -99,7 +96,7 @@ module Faker
99
96
  # with an array of values and selecting one of them.
100
97
  def fetch(key)
101
98
  fetched = sample(translate("faker.#{key}"))
102
- if fetched&.match(%r{^\/}) && fetched&.match(%r{\/$}) # A regex
99
+ if fetched&.match(%r{^/}) && fetched&.match(%r{/$}) # A regex
103
100
  regexify(fetched)
104
101
  else
105
102
  fetched
@@ -111,7 +108,7 @@ module Faker
111
108
  def fetch_all(key)
112
109
  fetched = translate("faker.#{key}")
113
110
  fetched = fetched.last if fetched.size <= 1
114
- if !fetched.respond_to?(:sample) && fetched.match(%r{^\/}) && fetched.match(%r{\/$}) # A regex
111
+ if !fetched.respond_to?(:sample) && fetched.match(%r{^/}) && fetched.match(%r{/$}) # A regex
115
112
  regexify(fetched)
116
113
  else
117
114
  fetched
@@ -123,7 +120,7 @@ module Faker
123
120
  # formatted translation: e.g., "#{first_name} #{last_name}".
124
121
  def parse(key)
125
122
  fetched = fetch(key)
126
- parts = fetched.scan(/(\(?)#\{([A-Za-z]+\.)?([^\}]+)\}([^#]+)?/).map do |prefix, kls, meth, etc|
123
+ parts = fetched.scan(/(\(?)#\{([A-Za-z]+\.)?([^}]+)\}([^#]+)?/).map do |prefix, kls, meth, etc|
127
124
  # If the token had a class Prefix (e.g., Name.first_name)
128
125
  # grab the constant, otherwise use self
129
126
  cls = kls ? Faker.const_get(kls.chop) : self
@@ -132,7 +129,7 @@ module Faker
132
129
  # In either case the information will be retained for reconstruction of the string.
133
130
  text = prefix
134
131
 
135
- # If the class has the method, call it, otherwise fetch the transation
132
+ # If the class has the method, call it, otherwise fetch the translation
136
133
  # (e.g., faker.phone_number.area_code)
137
134
  text += if cls.respond_to?(meth)
138
135
  cls.send(meth)
@@ -167,12 +164,12 @@ module Faker
167
164
  end
168
165
 
169
166
  # Executes block with given locale set.
170
- def with_locale(tmp_locale = nil)
167
+ def with_locale(tmp_locale = nil, &block)
171
168
  current_locale = Faker::Config.own_locale
172
169
  Faker::Config.locale = tmp_locale
173
170
 
174
171
  disable_enforce_available_locales do
175
- I18n.with_locale(tmp_locale) { yield }
172
+ I18n.with_locale(tmp_locale, &block)
176
173
  end
177
174
  ensure
178
175
  Faker::Config.locale = current_locale
@@ -225,8 +222,16 @@ module Faker
225
222
  @unique ||= UniqueGenerator.new(self, max_retries)
226
223
  end
227
224
 
228
- def sample(list)
229
- list.respond_to?(:sample) ? list.sample(random: Faker::Config.random) : list
225
+ def sample(list, num = nil)
226
+ if list.respond_to?(:sample)
227
+ if num
228
+ list.sample(num, random: Faker::Config.random)
229
+ else
230
+ list.sample(random: Faker::Config.random)
231
+ end
232
+ else
233
+ list
234
+ end
230
235
  end
231
236
 
232
237
  def shuffle(list)
@@ -307,4 +312,4 @@ module Faker
307
312
  end
308
313
 
309
314
  # require faker objects
310
- Dir.glob(File.join(File.dirname(__FILE__), 'faker', '/**/*.rb')).sort.each { |file| require file }
315
+ Dir.glob(File.join(mydir, 'faker', '/**/*.rb')).sort.each { |file| require file }
@@ -14,7 +14,7 @@ module Faker
14
14
  # #=> "ak_zvU8YQLagjcfng7Tg8yCdiZ1rpiWNp1PBn3vtUs44utSvbJVR"
15
15
  #
16
16
  def address
17
- 'ak_' + rand_strings
17
+ "ak_#{rand_strings}"
18
18
  end
19
19
 
20
20
  ##
@@ -27,7 +27,7 @@ module Faker
27
27
  # #=> "th_147nDP22h3pHrLt2qykTH4txUwQh1ccaXp"
28
28
  #
29
29
  def transaction
30
- 'th_' + rand_strings(51)
30
+ "th_#{rand_strings(51)}"
31
31
  end
32
32
 
33
33
  ##
@@ -40,7 +40,7 @@ module Faker
40
40
  # #=> "ct_Hk2JsNeWGEYQEHHQCfcBeGrwbhtYSwFTPdDhW2SvjFYVojyhW"
41
41
  #
42
42
  def contract
43
- 'ct_' + rand_strings
43
+ "ct_#{rand_strings}"
44
44
  end
45
45
 
46
46
  ##
@@ -53,7 +53,7 @@ module Faker
53
53
  # #=> "ok_28QDg7fkF5qiKueSdUvUBtCYPJdmMEoS73CztzXCRAwMGKHKZh"
54
54
  #
55
55
  def oracle
56
- 'ok_' + rand_strings(51)
56
+ "ok_#{rand_strings(51)}"
57
57
  end
58
58
 
59
59
  protected
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'digest'
3
+ require 'openssl'
4
4
  require 'securerandom'
5
5
 
6
6
  module Faker
@@ -51,7 +51,7 @@ module Faker
51
51
  def address_for(network)
52
52
  version = PROTOCOL_VERSIONS.fetch(network)
53
53
  packed = version.chr + Faker::Config.random.bytes(20)
54
- checksum = Digest::SHA2.digest(Digest::SHA2.digest(packed))[0..3]
54
+ checksum = OpenSSL::Digest::SHA256.digest(OpenSSL::Digest::SHA256.digest(packed))[0..3]
55
55
  Faker::Base58.encode(packed + checksum)
56
56
  end
57
57
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'digest'
3
+ require 'openssl'
4
4
  require 'securerandom'
5
5
 
6
6
  module Faker
@@ -88,6 +88,34 @@ module Faker
88
88
  encode_tz(:edsig, 64)
89
89
  end
90
90
 
91
+ ##
92
+ # Produces a random Tezos public key
93
+ #
94
+ # @return [String]
95
+ #
96
+ # @example
97
+ # Faker::Blockchain::Tezos.public_key
98
+ # #=> "edpkuib9x8QXRc5nWwHUg7U1dXsVmaUrUNU5sX9pVEEvwbMVdfMCeq"
99
+ #
100
+ # @faker.version 2.15.2
101
+ def public_key
102
+ encode_tz(:edpk, 32)
103
+ end
104
+
105
+ ##
106
+ # Produces a random Tezos public key
107
+ #
108
+ # @return [String]
109
+ #
110
+ # @example
111
+ # Faker::Blockchain::Tezos.secret_key
112
+ # #=> "edsk3HZCAGEGpzQPnQUwQeFY4ESanFhQCgLpKriQw8GHyhKCrjHawv"
113
+ #
114
+ # @faker.version 2.15.2
115
+ def secret_key
116
+ encode_tz(:edsk, 32)
117
+ end
118
+
91
119
  protected
92
120
 
93
121
  ##
@@ -98,7 +126,7 @@ module Faker
98
126
  def encode_tz(prefix, payload_size)
99
127
  prefix = PREFIXES.fetch(prefix)
100
128
  packed = prefix.map(&:chr).join('') + Faker::Config.random.bytes(payload_size)
101
- checksum = Digest::SHA2.digest(Digest::SHA2.digest(packed))[0..3]
129
+ checksum = OpenSSL::Digest::SHA256.digest(OpenSSL::Digest::SHA256.digest(packed))[0..3]
102
130
  Faker::Base58.encode(packed + checksum)
103
131
  end
104
132
  end
@@ -30,6 +30,19 @@ module Faker
30
30
  fetch('dune.titles')
31
31
  end
32
32
 
33
+ ##
34
+ # Produces the name of a city from Dune
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Books::Dune.city #=> "Arrakeen"
40
+ #
41
+ # @faker.version next
42
+ def city
43
+ fetch('dune.cities')
44
+ end
45
+
33
46
  ##
34
47
  # Produces the name of a planet from Dune
35
48
  #
@@ -76,7 +89,7 @@ module Faker
76
89
  end
77
90
  end
78
91
 
79
- fetch('dune.quotes.' + character)
92
+ fetch("dune.quotes.#{character}")
80
93
  end
81
94
 
82
95
  ##
@@ -111,7 +124,7 @@ module Faker
111
124
  end
112
125
  end
113
126
 
114
- fetch('dune.sayings.' + source)
127
+ fetch("dune.sayings.#{source}")
115
128
  end
116
129
  end
117
130
  end