faker 3.5.2 → 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 (245) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +133 -0
  3. data/README.md +78 -393
  4. data/lib/faker/blockchain/bitcoin.rb +0 -1
  5. data/lib/faker/blockchain/tezos.rb +0 -1
  6. data/lib/faker/books/lovecraft.rb +1 -1
  7. data/lib/faker/default/avatar.rb +1 -1
  8. data/lib/faker/default/bank.rb +1 -5
  9. data/lib/faker/default/boolean.rb +2 -1
  10. data/lib/faker/default/company.rb +1 -1
  11. data/lib/faker/default/crypto.rb +0 -2
  12. data/lib/faker/default/hipster.rb +1 -1
  13. data/lib/faker/default/html.rb +1 -1
  14. data/lib/faker/default/id_number.rb +1 -1
  15. data/lib/faker/default/lorem.rb +1 -1
  16. data/lib/faker/default/lorem_flickr.rb +1 -1
  17. data/lib/faker/default/markdown.rb +2 -2
  18. data/lib/faker/default/placeholdit.rb +1 -1
  19. data/lib/faker/default/string.rb +1 -1
  20. data/lib/faker/default/types.rb +2 -2
  21. data/lib/faker/default/x.rb +189 -0
  22. data/lib/faker/music/bossa_nova.rb +37 -0
  23. data/lib/faker/version.rb +1 -1
  24. data/lib/faker.rb +13 -10
  25. data/lib/helpers/unique_generator.rb +1 -1
  26. data/lib/locales/README.md +2 -2
  27. data/lib/locales/ar.yml +1606 -49
  28. data/lib/locales/bg.yml +935 -18
  29. data/lib/locales/ca-CAT.yml +347 -12
  30. data/lib/locales/ca.yml +580 -7
  31. data/lib/locales/ee.yml +1185 -26
  32. data/lib/locales/en/adjective.yml +174 -174
  33. data/lib/locales/en/airport.yml +374 -374
  34. data/lib/locales/en/ancient.yml +128 -4
  35. data/lib/locales/en/animal.yml +141 -2
  36. data/lib/locales/en/app.yml +89 -2
  37. data/lib/locales/en/appliance.yml +81 -2
  38. data/lib/locales/en/aqua_teen_hunger_force.yml +31 -31
  39. data/lib/locales/en/artist.yml +43 -1
  40. data/lib/locales/en/avatar.yml +54 -28
  41. data/lib/locales/en/back_to_the_future.yml +145 -117
  42. data/lib/locales/en/bank.yml +91 -2
  43. data/lib/locales/en/beer.yml +232 -6
  44. data/lib/locales/en/bible.yml +3 -6
  45. data/lib/locales/en/big_bang_theory.yml +34 -35
  46. data/lib/locales/en/bird.yml +1225 -1226
  47. data/lib/locales/en/bojack_horseman.yml +63 -3
  48. data/lib/locales/en/bossa_nova.yml +110 -3
  49. data/lib/locales/en/breaking_bad.yml +110 -25
  50. data/lib/locales/en/brooklyn_nine_nine.yml +0 -1
  51. data/lib/locales/en/buffy.yml +239 -257
  52. data/lib/locales/en/business.yml +18 -2
  53. data/lib/locales/en/cannabis.yml +344 -10
  54. data/lib/locales/en/cat.yml +155 -3
  55. data/lib/locales/en/chess.yml +2 -3
  56. data/lib/locales/en/chiquito.yml +60 -61
  57. data/lib/locales/en/chuck_norris.yml +78 -79
  58. data/lib/locales/en/clash_of_clan.yml +0 -2
  59. data/lib/locales/en/code.yml +501 -1
  60. data/lib/locales/en/coffee.yml +450 -25
  61. data/lib/locales/en/color.yml +73 -1
  62. data/lib/locales/en/commerce.yml +117 -23
  63. data/lib/locales/en/community.yml +55 -30
  64. data/lib/locales/en/company.yml +1756 -14
  65. data/lib/locales/en/compass.yml +108 -12
  66. data/lib/locales/en/conan.yml +0 -2
  67. data/lib/locales/en/construction.yml +416 -422
  68. data/lib/locales/en/cosmere.yml +219 -54
  69. data/lib/locales/en/cowboy_bebop.yml +56 -59
  70. data/lib/locales/en/culture_series.yml +298 -298
  71. data/lib/locales/en/currency.yml +358 -3
  72. data/lib/locales/en/dc_comics.yml +178 -49
  73. data/lib/locales/en/demographic.yml +215 -215
  74. data/lib/locales/en/departed.yml +40 -44
  75. data/lib/locales/en/dessert.yml +78 -3
  76. data/lib/locales/en/doraemon.yml +278 -280
  77. data/lib/locales/en/dr_who.yml +468 -93
  78. data/lib/locales/en/dragon_ball.yml +240 -240
  79. data/lib/locales/en/dumb_and_dumber.yml +72 -56
  80. data/lib/locales/en/elder_scrolls.yml +52 -53
  81. data/lib/locales/en/electrical_components.yml +49 -3
  82. data/lib/locales/en/esport.yml +58 -5
  83. data/lib/locales/en/family_guy.yml +54 -4
  84. data/lib/locales/en/file.yml +108 -9
  85. data/lib/locales/en/final_space.yml +1 -3
  86. data/lib/locales/en/food.yml +1 -1
  87. data/lib/locales/en/football.yml +112 -5
  88. data/lib/locales/en/fresh_prince_of_bel_air.yml +119 -70
  89. data/lib/locales/en/friends.yml +162 -3
  90. data/lib/locales/en/funny_name.yml +752 -1
  91. data/lib/locales/en/futurama.yml +7 -15
  92. data/lib/locales/en/game_of_thrones.yml +2487 -5
  93. data/lib/locales/en/gender.yml +15 -3
  94. data/lib/locales/en/ghostbusters.yml +101 -88
  95. data/lib/locales/en/grateful_dead.yml +47 -45
  96. data/lib/locales/en/greek_philosophers.yml +44 -23
  97. data/lib/locales/en/hacker.yml +110 -5
  98. data/lib/locales/en/hackers.yml +1 -1
  99. data/lib/locales/en/harry_potter.yml +323 -6
  100. data/lib/locales/en/hey_arnold.yml +104 -21
  101. data/lib/locales/en/hipster.yml +203 -1
  102. data/lib/locales/en/hitchhikers_guide_to_the_galaxy.yml +243 -42
  103. data/lib/locales/en/hobby.yml +0 -1
  104. data/lib/locales/en/horse.yml +446 -2
  105. data/lib/locales/en/house.yml +34 -2
  106. data/lib/locales/en/how_i_met_your_mother.yml +97 -25
  107. data/lib/locales/en/how_to_train_your_dragon.yml +0 -1
  108. data/lib/locales/en/id_number.yml +6 -1
  109. data/lib/locales/en/industry_segments.yml +188 -4
  110. data/lib/locales/en/job.yml +98 -7
  111. data/lib/locales/en/kamen_rider.yml +272 -6
  112. data/lib/locales/en/kpop.yml +954 -80
  113. data/lib/locales/en/lebowski.yml +58 -40
  114. data/lib/locales/en/lorem.yml +1095 -6
  115. data/lib/locales/en/markdown.yml +12 -2
  116. data/lib/locales/en/marketing.yml +54 -1
  117. data/lib/locales/en/measurement.yml +42 -8
  118. data/lib/locales/en/michael_scott.yml +41 -42
  119. data/lib/locales/en/movie.yml +188 -176
  120. data/lib/locales/en/name.yml +6068 -6
  121. data/lib/locales/en/nato_phonetic_alphabet.yml +27 -1
  122. data/lib/locales/en/new_girl.yml +35 -37
  123. data/lib/locales/en/one_piece.yml +359 -6
  124. data/lib/locales/en/opera.yml +1 -1
  125. data/lib/locales/en/overwatch.yml +1 -1
  126. data/lib/locales/en/parks_and_rec.yml +33 -4
  127. data/lib/locales/en/pearl_jam.yml +207 -207
  128. data/lib/locales/en/phish.yml +388 -389
  129. data/lib/locales/en/prince.yml +219 -219
  130. data/lib/locales/en/princess_bride.yml +48 -2
  131. data/lib/locales/en/programming_language.yml +753 -3
  132. data/lib/locales/en/quote.yml +599 -685
  133. data/lib/locales/en/rajnikanth.yml +74 -74
  134. data/lib/locales/en/relationship.yml +29 -6
  135. data/lib/locales/en/restaurant.yml +31 -31
  136. data/lib/locales/en/rick_and_morty.yml +116 -3
  137. data/lib/locales/en/rock_band.yml +228 -2
  138. data/lib/locales/en/rupaul.yml +120 -122
  139. data/lib/locales/en/seinfeld.yml +110 -3
  140. data/lib/locales/en/shakespeare.yml +46 -50
  141. data/lib/locales/en/silicon_valley.yml +122 -50
  142. data/lib/locales/en/simpsons.yml +897 -691
  143. data/lib/locales/en/slack_emoji.yml +874 -8
  144. data/lib/locales/en/space.yml +373 -14
  145. data/lib/locales/en/star_trek.yml +105 -4
  146. data/lib/locales/en/star_wars.yml +525 -528
  147. data/lib/locales/en/stargate.yml +65 -18
  148. data/lib/locales/en/stranger_thing.yml +31 -33
  149. data/lib/locales/en/street_fighter.yml +1 -1
  150. data/lib/locales/en/subscription.yml +47 -5
  151. data/lib/locales/en/superhero.yml +574 -4
  152. data/lib/locales/en/sword_art_online.yml +327 -331
  153. data/lib/locales/en/team.yml +125 -3
  154. data/lib/locales/en/the_expanse.yml +92 -4
  155. data/lib/locales/en/the_it_crowd.yml +148 -152
  156. data/lib/locales/en/the_office.yml +77 -81
  157. data/lib/locales/en/the_room.yml +35 -35
  158. data/lib/locales/en/the_thick_of_it.yml +83 -3
  159. data/lib/locales/en/theater.yml +593 -593
  160. data/lib/locales/en/tolkien.yml +2 -2
  161. data/lib/locales/en/touhou.yml +54 -54
  162. data/lib/locales/en/tron.yml +191 -191
  163. data/lib/locales/en/twin_peaks.yml +130 -3
  164. data/lib/locales/en/umphreys_mcgee.yml +266 -1
  165. data/lib/locales/en/university.yml +15 -2
  166. data/lib/locales/en/v_for_vendetta.yml +157 -160
  167. data/lib/locales/en/venture_bros.yml +225 -4
  168. data/lib/locales/en/verbs.yml +3785 -5
  169. data/lib/locales/en/volleyball.yml +493 -493
  170. data/lib/locales/en/warhammer_fantasy.yml +540 -573
  171. data/lib/locales/en/world_cup.yml +1132 -235
  172. data/lib/locales/en/yoda.yml +38 -1
  173. data/lib/locales/en-BORK.yml +104 -1
  174. data/lib/locales/en-GB.yml +9 -7
  175. data/lib/locales/en-NG.yml +737 -66
  176. data/lib/locales/en-TH.yml +1 -1
  177. data/lib/locales/en-UG.yml +374 -76
  178. data/lib/locales/en-ZA.yml +1394 -13
  179. data/lib/locales/es-AR.yml +1 -1
  180. data/lib/locales/es-MX.yml +1907 -40
  181. data/lib/locales/es.yml +2117 -52
  182. data/lib/locales/fa.yml +1624 -5
  183. data/lib/locales/fi-FI.yml +315 -17
  184. data/lib/locales/fr/adjective.yml +261 -261
  185. data/lib/locales/fr/ancient.yml +134 -134
  186. data/lib/locales/fr/animal.yml +118 -1
  187. data/lib/locales/fr/appliance.yml +66 -1
  188. data/lib/locales/fr/book.yml +27 -3
  189. data/lib/locales/fr/color.yml +31 -1
  190. data/lib/locales/fr/company.yml +490 -10
  191. data/lib/locales/fr/compass.yml +58 -10
  192. data/lib/locales/fr/demographic.yml +3 -1
  193. data/lib/locales/fr/gender.yml +18 -3
  194. data/lib/locales/fr/internet.yml +12 -1
  195. data/lib/locales/fr/lorem.yml +1091 -2
  196. data/lib/locales/fr/measurement.yml +31 -4
  197. data/lib/locales/fr/name.yml +1176 -5
  198. data/lib/locales/fr/phone_number.yml +34 -3
  199. data/lib/locales/fr/pokemon.yml +417 -3
  200. data/lib/locales/fr-CA.yml +12 -6
  201. data/lib/locales/fr-CH.yml +2455 -41
  202. data/lib/locales/he.yml +255 -9
  203. data/lib/locales/hy.yml +12 -6
  204. data/lib/locales/it.yml +12 -6
  205. data/lib/locales/ja/address.yml +350 -120526
  206. data/lib/locales/ja/ancient.yml +15 -1
  207. data/lib/locales/ja/animal.yml +83 -1
  208. data/lib/locales/ja/artist.yml +46 -0
  209. data/lib/locales/ja/bank.yml +136 -1
  210. data/lib/locales/ja/cat.yml +75 -1
  211. data/lib/locales/ja/coffee.yml +19 -1
  212. data/lib/locales/ja/color.yml +32 -1
  213. data/lib/locales/ja/commerce.yml +98 -6
  214. data/lib/locales/ja/company.yml +20 -2
  215. data/lib/locales/ja/dog.yml +335 -2
  216. data/lib/locales/ja/emotion.yml +1 -3
  217. data/lib/locales/ja/food.yml +38 -1
  218. data/lib/locales/ja/gender.yml +3 -1
  219. data/lib/locales/ja/lorem.yml +1014 -3
  220. data/lib/locales/ja/name.yml +203 -3
  221. data/lib/locales/ja/overwatch.yml +33 -1
  222. data/lib/locales/ja/phone_number.yml +9 -3
  223. data/lib/locales/ja/pokemon.yml +437 -3
  224. data/lib/locales/ja/relationship.yml +29 -6
  225. data/lib/locales/ja/restaurant.yml +74 -3
  226. data/lib/locales/ja/space.yml +20 -2
  227. data/lib/locales/ja/subscription.yml +47 -5
  228. data/lib/locales/ja/super_mario.yml +68 -4
  229. data/lib/locales/ja/university.yml +15 -2
  230. data/lib/locales/ja/zelda.yml +15 -1
  231. data/lib/locales/ko.yml +1 -1
  232. data/lib/locales/lv.yml +1221 -26
  233. data/lib/locales/nl.yml +33507 -56
  234. data/lib/locales/pl.yml +4008 -37
  235. data/lib/locales/sk.yml +12 -6
  236. data/lib/locales/sv.yml +639 -49
  237. data/lib/locales/th.yml +375 -375
  238. data/lib/locales/tr.yml +77 -18
  239. data/lib/locales/uk.yml +7 -7
  240. data/lib/locales/vi.yml +392 -49
  241. data/lib/locales/zh-CN.yml +540 -19
  242. data/lib/locales/zh-TW.yml +1030 -15
  243. metadata +7 -6
  244. data/lib/faker/default/bossa_nova.rb +0 -33
  245. data/lib/faker/default/twitter.rb +0 -207
data/README.md CHANGED
@@ -1,18 +1,16 @@
1
- ![logotype a happy-07](https://user-images.githubusercontent.com/36028424/40263395-4318481e-5b44-11e8-92e5-3dcc1ce169b3.png)
1
+ # Faker [![Gem Version][version-badge]][rubygems] [![Build Status][github-actions-badge]][github-actions] [![Total Downloads][downloads-total]][rubygems] [![Downloads][downloads-badge]][rubygems]
2
2
 
3
- # Faker
4
- [![Tests](https://github.com/faker-ruby/faker/workflows/Tests/badge.svg)](https://github.com/faker-ruby/faker/actions?query=workflow%3ATests)
5
- [![Gem Version](https://badge.fury.io/rb/faker.svg)](https://badge.fury.io/rb/faker)
6
- [![Inline docs](https://inch-ci.org/github/faker-ruby/faker.svg?branch=main)](https://inch-ci.org/github/faker-ruby/faker)
3
+ <div align="center">
4
+ <img src="https://user-images.githubusercontent.com/36028424/40263395-4318481e-5b44-11e8-92e5-3dcc1ce169b3.png" width="400"/>
5
+ <p>Generate (almost) realistic fake data for testing, demos, and populating your database during development.</p>
6
+ </div>
7
7
 
8
- Faker is a port of [Perl's Data::Faker library](https://metacpan.org/pod/Data::Faker).
9
- It's a library for generating fake data such as names, addresses, and phone numbers.
10
-
11
- Faker helps you generate realistic test data, and populate your
12
- database with more than a couple of records while you're doing development.
13
-
14
- It comes in very handy for taking screenshots (taking screenshots for a personal project)
15
- and it was the original impetus for the creation of this gem.
8
+ [version-badge]: https://img.shields.io/gem/v/faker.svg
9
+ [rubygems]: https://rubygems.org/gems/faker
10
+ [github-actions-badge]: https://img.shields.io/github/actions/workflow/status/faker-ruby/faker/.github/workflows/ruby.yml?branch=main
11
+ [github-actions]: https://github.com/faker-ruby/faker/actions
12
+ [downloads-total]: https://img.shields.io/gem/dt/faker.svg
13
+ [downloads-badge]: https://img.shields.io/gem/dtv/faker.svg
16
14
 
17
15
  ## Quick links
18
16
 
@@ -22,40 +20,19 @@ and it was the original impetus for the creation of this gem.
22
20
  [rubydocs]: https://www.rubydoc.info/gems/faker/
23
21
  [changelog]: CHANGELOG.md
24
22
 
25
- ## In the media
23
+ ## Features
26
24
 
27
- - 📰 [With Great Humor Comes Great Developer Engagement] - KTH Royal Institute of Technology research
28
- - 🎧 [Computer und Kommunikation 4.5.2024, komplette Sendung] - Deutschland Funk Radio Interview
25
+ - Internet: Email addresses, Passwords, Domains, etc.
26
+ - Date and Time: Travel back in time or to the future.
27
+ - Person: Names, Genders, Bios, Job titles, and more.
28
+ - Number and String: Random numbers and strings.
29
+ - Location: Addresses, Zip Codes, Street Names, States, and Countries.
30
+ - Finance: Account Details, Transactions, and Crypto Addresses.
31
+ - Localization - Customize faker with over 40 locales to generate realistic-looking Names, Addresses, and Phone Numbers.
29
32
 
30
- [With Great Humor Comes Great Developer Engagement]: https://arxiv.org/pdf/2312.01680
31
- [Computer und Kommunikation 4.5.2024, komplette Sendung]: https://www.deutschlandfunk.de/computer-und-kommunikation-4-5-2024-komplette-sendung-dlf-16492b03-100.html
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.
32
34
 
33
- ## Table of Contents
34
-
35
- - [Faker](#faker)
36
- - [Quick links](#quick-links)
37
- - [Table of Contents](#table-of-contents)
38
- - [Notes](#notes)
39
- - [Getting Started](#getting-started)
40
- - [Usage](#usage)
41
- - [A note about the Generators versions](#a-note-about-the-generators-versions)
42
- - [Ensuring unique values](#ensuring-unique-values)
43
- - [Deterministic Random](#deterministic-random)
44
- - [Customization](#customization)
45
- - [Minitest and Faker \>= 2.22](#minitest-and-faker--222)
46
- - [Generators](#generators)
47
- - [Contributing](#contributing)
48
- - [Versioning](#versioning)
49
- - [License](#license)
50
-
51
- ### Notes
52
-
53
- * While Faker generates data at random, returned values are not guaranteed to be unique by default.
54
- To explicitly specify when you require unique values, see [Ensuring Unique Values](#ensuring-unique-values).
55
- Values also can be deterministic if you use the deterministic feature, see [Deterministic Random](#deterministic-random)
56
- * This is the `main` branch of Faker and may contain changes that are not yet released.
57
- Please refer to the README of your version for the available methods.
58
- The list of all versions is [available here](https://github.com/stympy/faker/releases).
35
+ For a complete list of the generators, see [Generators](./GENERATORS.md).
59
36
 
60
37
  ## Getting Started
61
38
 
@@ -69,49 +46,44 @@ Then run `bundle install`.
69
46
 
70
47
  ## Usage
71
48
 
72
- Here are some examples of how to use Faker:
73
-
74
49
  ```ruby
75
50
  require 'faker'
76
51
 
77
- Faker::Name.name #=> "Christophe Bartell"
78
-
79
- Faker::Address.full_address #=> "5479 William Way, East Sonnyhaven, LA 63637"
80
-
81
- Faker::Markdown.emphasis #=> "Quo qui aperiam. Amet corrupti distinctio. Sit quia *dolor.*"
82
-
83
- Faker::TvShows::RuPaul.queen #=> "Violet Chachki"
84
-
52
+ Faker::Name.name #=> "Christophe Bartell"
53
+ Faker::Internet.password #=> "Vg5mSvY1UeRg7"
54
+ Faker::Internet.email #=> "eliza@mann.test"
55
+ Faker::Address.full_address #=> "5479 William Way, East Sonnyhaven, LA 63637"
56
+ Faker::Markdown.emphasis #=> "Quo qui aperiam. Amet corrupti distinctio. Sit quia *dolor.*"
57
+ Faker::Lorem.paragraph #=> "Recusandae minima consequatur. Expedita sequi blanditiis. Ut fuga et."
85
58
  Faker::Alphanumeric.alpha(number: 10) #=> "zlvubkrwga"
86
-
87
- Faker::ProgrammingLanguage.name #=> "Ruby"
59
+ Faker::ProgrammingLanguage.name #=> "Ruby"
88
60
  ```
89
61
 
90
- For a complete list of the generators, see [Generators](#generators).
91
-
92
- ### A note about the Generators versions
93
-
94
- If you get a `uninitialized constant Faker::[some_class]` error, your version of
95
- the gem is behind main.
96
-
97
- To make sure that your gem is the one
98
- documented here, change the line in your Gemfile to:
99
-
100
- ```ruby
101
- gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main'
102
- ```
62
+ ## Table of Contents
103
63
 
104
- The generators have the `@faker.version` tag on top of their implementation.
105
- From the tags, you can identify the version the generator was added:
64
+ - [Faker ](#faker----)
65
+ - [Quick links](#quick-links)
66
+ - [Features](#features)
67
+ - [Getting Started](#getting-started)
68
+ - [Usage](#usage)
69
+ - [Table of Contents](#table-of-contents)
70
+ - [Notes](#notes)
71
+ - [Ensuring unique values](#ensuring-unique-values)
72
+ - [Deterministic Random](#deterministic-random)
73
+ - [Localization](#localization)
74
+ - [Minitest and Faker \>= 2.22](#minitest-and-faker--222)
75
+ - [Generators](#generators)
76
+ - [Contributing](#contributing)
77
+ - [Versioning](#versioning)
78
+ - [Inspiration](#inspiration)
79
+ - [In the media](#in-the-media)
80
+ - [License](#license)
106
81
 
107
- ```ruby
108
- # Faker::TvShows::ParksAndRec.character
82
+ ### Notes
109
83
 
110
- # @faker.version 1.9.0
111
- def character
112
- fetch('parks_and_rec.characters')
113
- end
114
- ```
84
+ * While Faker generates data at random, returned values are not guaranteed to be unique by default. To explicitly specify when you require unique values, see [Ensuring Unique Values](#ensuring-unique-values).
85
+ * Values also can be deterministic if you use the deterministic feature, see [Deterministic Random](#deterministic-random).
86
+ * This is the `main` branch of Faker and may contain changes that are not yet released. The list of all versions is [available here](https://github.com/stympy/faker/releases).
115
87
 
116
88
  ### Ensuring unique values
117
89
 
@@ -127,16 +99,15 @@ exception may be raised. It is possible to clear the record of unique values
127
99
  that have been returned, for example between tests.
128
100
 
129
101
  ```ruby
130
- Faker::Name.unique.clear # Clears used values for Faker::Name
102
+ Faker::Name.unique.clear # Clears used values for Faker::Name
131
103
  Faker::UniqueGenerator.clear # Clears used values for all generators
132
104
  ```
133
105
 
134
- You also can give some already used values to the unique generator if you have
135
- 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
136
108
  manually set values).
137
109
 
138
110
  ```ruby
139
- # Usage:
140
111
  # Faker::<generator>.unique.exclude(method, arguments, list)
141
112
 
142
113
  # Add 'azerty' and 'wxcvbn' to the string generator with 6 char length
@@ -150,18 +121,19 @@ to provide deterministic output of repeated method calls.
150
121
 
151
122
  ```ruby
152
123
  Faker::Config.random = Random.new(42)
153
- Faker::Company.bs #=> "seize collaborative mindshare"
154
- Faker::Company.bs #=> "engage strategic platforms"
124
+ Faker::Lorem.word #=> "velit"
125
+ Faker::Lorem.word #=> "quisquam"
126
+
155
127
  Faker::Config.random = Random.new(42)
156
- Faker::Company.bs #=> "seize collaborative mindshare"
157
- Faker::Company.bs #=> "engage strategic platforms"
128
+ Faker::Lorem.word #=> "velit"
129
+ Faker::Lorem.word #=> "quisquam"
158
130
 
159
- Faker::Config.random = nil # seeds the PRNG using default entropy sources
160
- Faker::Config.random.seed #=> 185180369676275068918401850258677722187
161
- Faker::Company.bs #=> "cultivate viral synergies"
131
+ Faker::Config.random = nil # seeds the PRNG using default entropy sources
132
+ Faker::Config.random.seed #=> 185180369676275068918401850258677722187
133
+ Faker::Lorem.word #=> "ipsam"
162
134
  ```
163
135
 
164
- ### Customization
136
+ ### Localization
165
137
 
166
138
  You may want Faker to print information depending on your location in the world.
167
139
  To assist you in this, Faker uses the `I18n` gem to store strings and formats to
@@ -180,315 +152,16 @@ check out the [locales README](lib/locales/README.md).
180
152
 
181
153
  ### Minitest and Faker >= 2.22
182
154
 
183
- To prevent Faker (version >= 2.22) from generating duplicate values 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,
184
156
  you might need to add the following to the `test_helper.rb` or `rails_helper.rb` file:
185
157
 
186
158
  ```ruby
187
- Faker::Config.random = Random.new
159
+ Faker::Config.random = Random.new
188
160
  ```
189
161
 
190
- See [Issue #2534](https://github.com/faker-ruby/faker/issues/2534) for more details.
191
-
192
162
  ## Generators
193
163
 
194
- This is the full list of generators available with this gem. If you need details about any of them, make sure to consult the documentation.
195
-
196
- **NOTE: Some of the generators below aren't released yet. If you want to use them, change the line in your gemfile to:**
197
-
198
- ```ruby
199
- gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main'
200
- ```
201
-
202
- <details>
203
- <summary>Default</summary>
204
-
205
- - [Faker::Address](doc/default/address.md)
206
- - [Faker::Alphanumeric](doc/default/alphanumeric.md)
207
- - [Faker::Ancient](doc/default/ancient.md)
208
- - [Faker::App](doc/default/app.md)
209
- - [Faker::Appliance](doc/default/appliance.md)
210
- - [Faker::Artist](doc/default/artist.md)
211
- - [Faker::Avatar](doc/default/avatar.md)
212
- - [Faker::Bank](doc/default/bank.md)
213
- - [Faker::Barcode](doc/default/barcode.md)
214
- - [Faker::Beer](doc/default/beer.md)
215
- - [Faker::Blood](doc/default/blood.md)
216
- - [Faker::Boolean](doc/default/boolean.md)
217
- - [Faker::BossaNova](doc/default/bossa_nova.md)
218
- - [Faker::Business](doc/default/business.md)
219
- - [Faker::Camera](doc/default/camera.md)
220
- - [Faker::Cannabis](doc/default/cannabis.md)
221
- - [Faker::ChileRut](doc/default/chile_rut.md)
222
- - [Faker::ChuckNorris](doc/default/chuck_norris.md)
223
- - [Faker::Code](doc/default/code.md)
224
- - [Faker::Coffee](doc/default/coffee.md)
225
- - [Faker::Coin](doc/default/coin.md)
226
- - [Faker::Color](doc/default/color.md)
227
- - [Faker::Commerce](doc/default/commerce.md)
228
- - [Faker::Company](doc/default/company.md)
229
- - [Faker::Compass](doc/default/compass.md)
230
- - [Faker::Computer](doc/default/computer.md)
231
- - [Faker::Construction](doc/default/construction.md)
232
- - [Faker::Cosmere](doc/default/cosmere.md)
233
- - [Faker::Crypto](doc/default/crypto.md)
234
- - [Faker::CryptoCoin](doc/default/crypto_coin.md)
235
- - [Faker::Currency](doc/default/currency.md)
236
- - [Faker::Date](doc/default/date.md)
237
- - [Faker::DcComics](doc/default/dc_comics.md)
238
- - [Faker::Demographic](doc/default/demographic.md)
239
- - [Faker::Dessert](doc/default/dessert.md)
240
- - [Faker::Device](doc/default/device.md)
241
- - [Faker::DrivingLicence](doc/default/driving_licence.md)
242
- - [Faker::Drone](doc/drone/drone.md)
243
- - [Faker::Educator](doc/default/educator.md)
244
- - [Faker::ElectricalComponents](doc/default/electrical_components.md)
245
- - [Faker::Emotion](doc/default/emotion.md)
246
- - [Faker::Esport](doc/default/esport.md)
247
- - [Faker::File](doc/default/file.md)
248
- - [Faker::Finance](doc/default/finance.md)
249
- - [Faker::Food](doc/default/food.md)
250
- - [Faker::FunnyName](doc/default/funny_name.md)
251
- - [Faker::Gender](doc/default/gender.md)
252
- - [Faker::GreekPhilosophers](doc/default/greek_philosophers.md)
253
- - [Faker::Hacker](doc/default/hacker.md)
254
- - [Faker::Hipster](doc/default/hipster.md)
255
- - [Faker::Hobby](doc/default/hobby.md)
256
- - [Faker::House](doc/default/house.md)
257
- - [Faker::IdNumber](doc/default/id_number.md)
258
- - [Faker::IndustrySegments](doc/default/industry_segments.md)
259
- - [Faker::Internet](doc/default/internet.md)
260
- - [Faker::Invoice](doc/default/invoice.md)
261
- - [Faker::Job](doc/default/job.md)
262
- - [Faker::Json](doc/default/json.md)
263
- - [Faker::Kpop](doc/default/kpop.md)
264
- - [Faker::Lorem](doc/default/lorem.md)
265
- - [Faker::LoremFlickr](doc/default/lorem_flickr.md)
266
- - [Faker::Markdown](doc/default/markdown.md)
267
- - [Faker::Marketing](doc/default/marketing.md)
268
- - [Faker::Measurement](doc/default/measurement.md)
269
- - [Faker::Military](doc/default/military.md)
270
- - [Faker::Mountain](doc/default/mountain.md)
271
- - [Faker::Name](doc/default/name.md)
272
- - [Faker::Nation](doc/default/nation.md)
273
- - [Faker::NatoPhoneticAlphabet](doc/default/nato_phonetic_alphabet.md)
274
- - [Faker::NationalHealthService](doc/default/national_health_service.md)
275
- - [Faker::Number](doc/default/number.md)
276
- - [Faker::Omniauth](doc/default/omniauth.md)
277
- - [Faker::PhoneNumber](doc/default/phone_number.md)
278
- - [Faker::Placeholdit](doc/default/placeholdit.md)
279
- - [Faker::ProgrammingLanguage](doc/default/programming_language.md)
280
- - [Faker::Relationship](doc/default/relationship.md)
281
- - [Faker::Restaurant](doc/default/restaurant.md)
282
- - [Faker::Science](doc/default/science.md)
283
- - [Faker::SlackEmoji](doc/default/slack_emoji.md)
284
- - [Faker::Source](doc/default/source.md)
285
- - [Faker::SouthAfrica](doc/default/south_africa.md)
286
- - [Faker::Space](doc/default/space.md)
287
- - [Faker::String](doc/default/string.md)
288
- - [Faker::Stripe](doc/default/stripe.md)
289
- - [Faker::Subscription](doc/default/subscription.md)
290
- - [Faker::Superhero](doc/default/superhero.md)
291
- - [Faker::Tea](doc/default/tea.md)
292
- - [Faker::Team](doc/default/team.md)
293
- - [Faker::Theater](doc/default/theater.md)
294
- - [Faker::Time](doc/default/time.md)
295
- - [Faker::Twitter](doc/default/twitter.md)
296
- - [Faker::Types](doc/default/types.md)
297
- - [Faker::University](doc/default/university.md)
298
- - [Faker::Vehicle](doc/default/vehicle.md)
299
- - [Faker::Verbs](doc/default/verbs.md)
300
- - [Faker::VulnerabilityIdentifier](doc/default/vulnerability_identifier.md)
301
- - [Faker::WorldCup](doc/default/world_cup.md)
302
- </details>
303
-
304
- <details>
305
- <summary>Blockchain</summary>
306
-
307
- - [Faker::Blockchain::Aeternity](doc/blockchain/aeternity.md)
308
- - [Faker::Blockchain::Bitcoin](doc/blockchain/bitcoin.md)
309
- - [Faker::Blockchain::Ethereum](doc/blockchain/ethereum.md)
310
- - [Faker::Blockchain::Tezos](doc/blockchain/tezos.md)
311
- </details>
312
-
313
- <details>
314
- <summary>Books</summary>
315
-
316
- - [Faker::Book](doc/books/book.md)
317
- - [Faker::Books::CultureSeries](doc/books/culture_series.md)
318
- - [Faker::Books::Dune](doc/books/dune.md)
319
- - [Faker::Books::Lovecraft](doc/books/lovecraft.md)
320
- - [Faker::Books::TheKingkillerChronicle](doc/books/the_kingkiller_chronicle.md)
321
- </details>
322
-
323
- <details>
324
- <summary>Fantasy</summary>
325
-
326
- - [Faker::Fantasy::Tolkien](doc/fantasy/tolkien.md)
327
- </details>
328
-
329
- <details>
330
- <summary>Travel</summary>
331
-
332
- - [Faker:Travel::Airport](doc/travel/airport.md)
333
- - [Faker:Travel::TrainStation](doc/travel/train_station.md)
334
- </details>
335
-
336
- <details>
337
- <summary>Creature</summary>
338
-
339
- - [Faker::Creature::Animal](doc/creature/animal.md)
340
- - [Faker::Creature::Bird](doc/creature/bird.md)
341
- - [Faker::Creature::Cat](doc/creature/cat.md)
342
- - [Faker::Creature::Dog](doc/creature/dog.md)
343
- - [Faker::Creature::Horse](doc/creature/horse.md)
344
- </details>
345
-
346
- <details>
347
- <summary>Games</summary>
348
-
349
- - [Faker::Game](doc/games/game.md)
350
- - [Faker::Games::ClashOfClans](doc/games/clash_of_clans.md)
351
- - [Faker::Games::DnD](doc/games/dnd.md)
352
- - [Faker::Games::Dota](doc/games/dota.md)
353
- - [Faker::Games::ElderScrolls](doc/games/elder_scrolls.md)
354
- - [Faker::Games::Fallout](doc/games/fallout.md)
355
- - [Faker::Games::FinalFantasyXIV](doc/games/final_fantasy_xiv.md)
356
- - [Faker::Games::HalfLife](doc/games/half_life.md)
357
- - [Faker::Games::Heroes](doc/games/heroes.md)
358
- - [Faker::Games::HeroesOfTheStorm](doc/games/heroes_of_the_storm.md)
359
- - [Faker::Games::LeagueOfLegends](doc/games/league_of_legends.md)
360
- - [Faker::Games::Minecraft](doc/games/minecraft.md)
361
- - [Faker::Games::Myst](doc/games/myst.md)
362
- - [Faker::Games::Overwatch](doc/games/overwatch.md)
363
- - [Faker::Games::Pokemon](doc/games/pokemon.md)
364
- - [Faker::Games::SonicTheHedgehog](doc/games/sonic_the_hedgehog.md)
365
- - [Faker::Games::StreetFighter](doc/games/street_fighter.md)
366
- - [Faker::Games::SuperMario](doc/games/super_mario.md)
367
- - [Faker::Games::SuperSmashBros](doc/games/super_smash_bros.md)
368
- - [Faker::Games::Touhou](doc/games/touhou.md)
369
- - [Faker::Games::WarhammerFantasy](doc/games/warhammer_fantasy.md)
370
- - [Faker::Games::Witcher](doc/games/witcher.md)
371
- - [Faker::Games::WorldOfWarcraft](doc/games/world_of_warcraft.md)
372
- - [Faker::Games::Zelda](doc/games/zelda.md)
373
- </details>
374
-
375
- <details>
376
- <summary>Japanese Media</summary>
377
-
378
- - [Faker::JapaneseMedia::CowboyBebop](doc/japanese_media/cowboy_bebop.md)
379
- - [Faker::JapaneseMedia::DragonBall](doc/japanese_media/dragon_ball.md)
380
- - [Faker::JapaneseMedia::OnePiece](doc/japanese_media/one_piece.md)
381
- - [Faker::JapaneseMedia::StudioGhibli](doc/japanese_media/studio_ghibli.md)
382
- - [Faker::JapaneseMedia::SwordArtOnline](doc/japanese_media/sword_art_online.md)
383
- - [Faker::JapaneseMedia::Naruto](doc/japanese_media/naruto.md)
384
- - [Faker::JapaneseMedia::Doraemon](doc/japanese_media/doraemon.md)
385
- - [Faker::JapaneseMedia::Conan](doc/japanese_media/conan.md)
386
- - [Faker::JapaneseMedia::FullmetalAlchemistBrotherhood](doc/japanese_media/fullmetal_alchemist_brotherhood.md)
387
- </details>
388
-
389
- <details>
390
- <summary>Movies</summary>
391
-
392
- - [Faker::Movie](doc/movies/movie.md)
393
- - [Faker::Movies::Avatar](doc/movies/avatar.md)
394
- - [Faker::Movies::BackToTheFuture](doc/movies/back_to_the_future.md)
395
- - [Faker::Movies::Departed](doc/movies/departed.md)
396
- - [Faker::Movies::Ghostbusters](doc/movies/ghostbusters.md)
397
- - [Faker::Movies::HarryPotter](doc/movies/harry_potter.md)
398
- - [Faker::Movies::HitchhikersGuideToTheGalaxy](doc/movies/hitchhikers_guide_to_the_galaxy.md)
399
- - [Faker::Movies::Hobbit](doc/movies/hobbit.md)
400
- - [Faker::Movies::HowToTrainYourDragon](doc/movies/how_to_train_your_dragon.md)
401
- - [Faker::Movies::Lebowski](doc/movies/lebowski.md)
402
- - [Faker::Movies::LordOfTheRings](doc/movies/lord_of_the_rings.md)
403
- - [Faker::Movies::PrincessBride](doc/movies/princess_bride.md)
404
- - [Faker::Movies::StarWars](doc/movies/star_wars.md)
405
- - [Faker::Movies::TRON](doc/movies/tron.md)
406
- - [Faker::Movies::VForVendetta](doc/movies/v_for_vendetta.md)
407
- </details>
408
-
409
- <details>
410
- <summary>Music</summary>
411
-
412
- - [Faker::Music](doc/music/music.md)
413
- - [Faker::Music::GratefulDead](doc/music/grateful_dead.md)
414
- - [Faker::Music::Hiphop](doc/music/hiphop.md)
415
- - [Faker::Music::Opera](doc/music/opera.md)
416
- - [Faker::Music::PearlJam](doc/music/pearl_jam.md)
417
- - [Faker::Music::Phish](doc/music/phish.md)
418
- - [Faker::Music::Prince](doc/music/prince.md)
419
- - [Faker::Music::RockBand](doc/music/rock_band.md)
420
- - [Faker::Music::Rush](doc/music/rush.md)
421
- - [Faker::Music::SmashingPumpkins](doc/music/smashing_pumpkins.md)
422
- - [Faker::Music::UmphreysMcgee](doc/music/umphreys_mcgee.md)
423
- </details>
424
-
425
- <details>
426
- <summary>Quotes</summary>
427
-
428
- - [Faker::Quote](doc/quotes/quote.md)
429
- - [Faker::Quotes::Chiquito](doc/quotes/chiquito.md)
430
- - [Faker::Quotes::Rajnikanth](doc/quotes/rajnikanth.md)
431
- - [Faker::Quotes::Shakespeare](doc/quotes/shakespeare.md)
432
- </details>
433
-
434
- <details>
435
- <summary>Sports</summary>
436
-
437
- - [Faker::Sport](doc/sports/sport.md)
438
- - [Faker::Sports::Basketball](doc/sports/basketball.md)
439
- - [Faker::Sports::Chess](doc/sports/chess.md)
440
- - [Faker::Sports::Football](doc/sports/football.md)
441
- - [Faker::Sports::Mountaineering](doc/sports/mountaineering.md)
442
- - [Faker::Sports::Volleyball](doc/sports/volleyball.md)
443
- </details>
444
-
445
- <details>
446
- <summary>Tv Shows</summary>
447
-
448
- - [Faker::TvShows::AquaTeenHungerForce](doc/tv_shows/aqua_teen_hunger_force.md)
449
- - [Faker::TvShows::Archer](doc/tv_shows/archer.md)
450
- - [Faker::TvShows::BigBangTheory](doc/tv_shows/big_bang_theory.md)
451
- - [Faker::TvShows::BojackHorseman](doc/tv_shows/bojack_horseman.md)
452
- - [Faker::TvShows::BreakingBad](doc/tv_shows/breaking_bad.md)
453
- - [Faker::TvShows::BrooklynNineNine](doc/tv_shows/brooklyn_nine_nine.md)
454
- - [Faker::TvShows::Buffy](doc/tv_shows/buffy.md)
455
- - [Faker::TvShows::Community](doc/tv_shows/community.md)
456
- - [Faker::TvShows::DrWho](doc/tv_shows/dr_who.md)
457
- - [Faker::TvShows::DumbAndDumber](doc/tv_shows/dumb_and_dumber.md)
458
- - [Faker::TvShows::FamilyGuy](doc/tv_shows/family_guy.md)
459
- - [Faker::TvShows::FinalSpace](doc/tv_shows/final_space.md)
460
- - [Faker::TvShows::Friends](doc/tv_shows/friends.md)
461
- - [Faker::TvShows::GameOfThrones](doc/tv_shows/game_of_thrones.md)
462
- - [Faker::TvShows::HeyArnold](doc/tv_shows/hey_arnold.md)
463
- - [Faker::TvShows::HowIMetYourMother](doc/tv_shows/how_i_met_your_mother.md)
464
- - [Faker::TvShows::MichaelScott](doc/tv_shows/michael_scott.md)
465
- - [Faker::TvShows::NewGirl](doc/tv_shows/new_girl.md)
466
- - [Faker::TvShows::ParksAndRec](doc/tv_shows/parks_and_rec.md)
467
- - [Faker::TvShows::RickAndMorty](doc/tv_shows/rick_and_morty.md)
468
- - [Faker::TvShows::RuPaul](doc/tv_shows/rupaul.md)
469
- - [Faker::TvShows::Seinfeld](doc/tv_shows/seinfeld.md)
470
- - [Faker::TvShows::SiliconValley](doc/tv_shows/silicon_valley.md)
471
- - [Faker::TvShows::Simpsons](doc/tv_shows/simpsons.md)
472
- - [Faker::TvShows::SouthPark](doc/tv_shows/south_park.md)
473
- - [Faker::TvShows::Spongebob](doc/tv_shows/spongebob.md)
474
- - [Faker::TvShows::StarTrek](doc/tv_shows/star_trek.md)
475
- - [Faker::TvShows::Stargate](doc/tv_shows/stargate.md)
476
- - [Faker::TvShows::StrangerThings](doc/tv_shows/stranger_things.md)
477
- - [Faker::TvShows::Suits](doc/tv_shows/suits.md)
478
- - [Faker::TvShows::Supernatural](doc/tv_shows/supernatural.md)
479
- - [Faker::TvShows::TheExpanse](doc/tv_shows/the_expanse.md)
480
- - [Faker::TvShows::TheFreshPrinceOfBelAir](doc/tv_shows/the_fresh_prince_of_bel_air.md)
481
- - [Faker::TvShows::TheITCrowd](doc/tv_shows/the_it_crowd.md)
482
- - [Faker::TvShows::TheThickOfIt](doc/tv_shows/the_thick_of_it.md)
483
- - [Faker::TvShows::TwinPeaks](doc/tv_shows/twin_peaks.md)
484
- - [Faker::TvShows::VentureBros](doc/tv_shows/venture_bros.md)
485
- </details>
486
-
487
- <details>
488
- <summary>Locations</summary>
489
-
490
- - [Faker::Locations::Australia](doc/locations/australia.md)
491
- </details>
164
+ To see the full list, check out the [GENERATORS](./GENERATORS.md) document.
492
165
 
493
166
  ## Contributing
494
167
 
@@ -499,7 +172,7 @@ instructions on setting up the repo on your machine, opening bug reports, unders
499
172
  and creating a good pull request.
500
173
 
501
174
  There is a [Discord channel](https://discord.gg/RMumTwB) to discuss anything
502
- regarding improvements or feature requests.
175
+ regarding improvements or feature requests. This is not actively monitored by the current maintainers.
503
176
 
504
177
  Thank you, contributors!
505
178
 
@@ -507,6 +180,18 @@ Thank you, contributors!
507
180
 
508
181
  Faker follows Semantic Versioning 2.0 as defined at https://semver.org.
509
182
 
183
+ ## Inspiration
184
+
185
+ Faker was inspired by [Perl's Data::Faker library](https://metacpan.org/pod/Data::Faker).
186
+
187
+ ## In the media
188
+
189
+ - 📰 [With Great Humor Comes Great Developer Engagement] - KTH Royal Institute of Technology research
190
+ - 🎧 [Computer und Kommunikation 4.5.2024, komplette Sendung] - Deutschland Funk Radio Interview
191
+
192
+ [With Great Humor Comes Great Developer Engagement]: https://arxiv.org/pdf/2312.01680
193
+ [Computer und Kommunikation 4.5.2024, komplette Sendung]: https://www.deutschlandfunk.de/computer-und-kommunikation-4-5-2024-komplette-sendung-dlf-16492b03-100.html
194
+
510
195
  ## License
511
196
 
512
197
  This code is free to use under the terms of the MIT license.
@@ -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
@@ -240,7 +240,7 @@ module Faker
240
240
 
241
241
  paragraph += " #{paragraph(sentence_count: 3)}" while paragraph.length < characters
242
242
 
243
- "#{paragraph[0...characters - 1]}."
243
+ "#{paragraph[0...(characters - 1)]}."
244
244
  end
245
245
  end
246
246
  end
@@ -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
@@ -17,11 +17,7 @@ module Faker
17
17
  #
18
18
  # @faker.version 1.9.1
19
19
  def account_number(digits: 10)
20
- output = ''
21
-
22
- output += rand.to_s[2..] while output.length < digits
23
-
24
- output[0...digits]
20
+ Array.new(digits) { rand(10) }.join
25
21
  end
26
22
 
27
23
  ##
@@ -15,7 +15,8 @@ module Faker
15
15
  # Faker::Boolean.boolean(true_ratio: 0.2) #=> false
16
16
  #
17
17
  # @faker.version 1.6.2
18
- def boolean(true_ratio: 0.5)
18
+ #
19
+ def boolean(true_ratio: 0.5) # rubocop:disable Naming/PredicateMethod
19
20
  (rand < true_ratio)
20
21
  end
21
22
  end
@@ -591,7 +591,7 @@ module Faker
591
591
 
592
592
  def weight_sum(array, weights)
593
593
  sum = 0
594
- (0..weights.size - 1).each do |index|
594
+ (0..(weights.size - 1)).each do |index|
595
595
  sum += (array[index] * weights[index])
596
596
  end
597
597
  sum
@@ -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
@@ -147,7 +147,7 @@ module Faker
147
147
 
148
148
  paragraph += " #{paragraph(sentence_count: 3, supplemental: supplemental)}" while paragraph.length < characters
149
149
 
150
- "#{paragraph[0...characters - 1]}."
150
+ "#{paragraph[0...(characters - 1)]}."
151
151
  end
152
152
  end
153
153
  end
@@ -187,7 +187,7 @@ module Faker
187
187
  def random(exclude: [])
188
188
  method_list = available_methods
189
189
  exclude.each { |ex| method_list.delete_if { |meth| meth == ex.to_sym } }
190
- send(method_list[Faker::Config.random.rand(0..method_list.length - 1)])
190
+ send(method_list[Faker::Config.random.rand(0..(method_list.length - 1))])
191
191
  end
192
192
 
193
193
  ##
@@ -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,