faker 2.22.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +88 -7
- data/History.md +1 -1
- data/README.md +11 -5
- data/lib/faker/blockchain/aeternity.rb +1 -1
- data/lib/faker/blockchain/ethereum.rb +1 -1
- data/lib/faker/blockchain/tezos.rb +1 -1
- data/lib/faker/books/dune.rb +2 -10
- data/lib/faker/books/lovecraft.rb +7 -38
- data/lib/faker/default/address.rb +5 -25
- data/lib/faker/default/alphanumeric.rb +2 -8
- data/lib/faker/default/app.rb +1 -10
- data/lib/faker/default/avatar.rb +1 -12
- data/lib/faker/default/bank.rb +9 -17
- data/lib/faker/default/boolean.rb +1 -4
- data/lib/faker/default/chile_rut.rb +8 -14
- data/lib/faker/default/code.rb +10 -23
- data/lib/faker/default/color.rb +77 -6
- data/lib/faker/default/commerce.rb +3 -17
- data/lib/faker/default/company.rb +6 -14
- data/lib/faker/default/crypto_coin.rb +3 -15
- data/lib/faker/default/date.rb +5 -38
- data/lib/faker/default/demographic.rb +1 -5
- data/lib/faker/default/driving_licence.rb +1 -11
- data/lib/faker/default/file.rb +5 -24
- data/lib/faker/default/fillmurray.rb +1 -10
- data/lib/faker/default/finance.rb +17 -7
- data/lib/faker/default/hipster.rb +6 -45
- data/lib/faker/default/id_number.rb +108 -11
- data/lib/faker/default/internet.rb +17 -71
- data/lib/faker/default/invoice.rb +3 -16
- data/lib/faker/default/json.rb +2 -20
- data/lib/faker/default/lorem.rb +9 -66
- data/lib/faker/default/lorem_flickr.rb +4 -32
- data/lib/faker/default/lorem_pixel.rb +4 -10
- data/lib/faker/default/markdown.rb +4 -9
- data/lib/faker/default/measurement.rb +8 -40
- data/lib/faker/default/name.rb +1 -5
- data/lib/faker/default/nhs.rb +2 -6
- data/lib/faker/default/number.rb +10 -55
- data/lib/faker/default/omniauth.rb +5 -39
- data/lib/faker/default/phone_number.rb +1 -5
- data/lib/faker/default/placeholdit.rb +1 -12
- data/lib/faker/default/relationship.rb +1 -5
- data/lib/faker/default/source.rb +3 -16
- data/lib/faker/default/string.rb +1 -5
- data/lib/faker/default/stripe.rb +4 -20
- data/lib/faker/default/time.rb +4 -32
- data/lib/faker/default/twitter.rb +3 -17
- data/lib/faker/default/types.rb +5 -27
- data/lib/faker/default/vehicle.rb +21 -21
- data/lib/faker/default/vulnerability_identifier.rb +23 -0
- data/lib/faker/default/world_cup.rb +2 -11
- data/lib/faker/games/dota.rb +1 -5
- data/lib/faker/games/tarkov.rb +205 -0
- data/lib/faker/japanese_media/kamen_rider.rb +2 -2
- data/lib/faker/japanese_media/one_piece.rb +1 -1
- data/lib/faker/movies/hackers.rb +48 -0
- data/lib/faker/movies/star_wars.rb +1 -5
- data/lib/faker/sports/sport.rb +110 -0
- data/lib/faker/version.rb +1 -1
- data/lib/faker.rb +15 -63
- data/lib/helpers/base58.rb +1 -1
- data/lib/helpers/unique_generator.rb +13 -11
- data/lib/locales/en/computer.yml +23 -4
- data/lib/locales/en/file.yml +9 -1
- data/lib/locales/en/finance.yml +3 -1
- data/lib/locales/en/hackers.yml +53 -0
- data/lib/locales/en/heroes.yml +2 -2
- data/lib/locales/en/one_piece.yml +1 -1
- data/lib/locales/en/opera.yml +1 -1
- data/lib/locales/en/overwatch.yml +5 -7
- data/lib/locales/en/source.yml +5 -0
- data/lib/locales/en/sport.yml +130 -0
- data/lib/locales/en/tarkov.yml +593 -0
- data/lib/locales/en/vehicle.yml +2809 -75
- data/lib/locales/en-CA.yml +1 -0
- data/lib/locales/es-AR.yml +2 -2
- data/lib/locales/fi-FI.yml +2 -1
- data/lib/locales/fr/ancient.yml +141 -0
- data/lib/locales/hy.yml +1 -1
- data/lib/locales/th.yml +76 -76
- metadata +50 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a9b68cfd73d84ab10a3382407a6675395cdb07fa17113b99b84390fef9a4fb5
|
4
|
+
data.tar.gz: 12fbdbeb4cbb3409954520b90a9fdfe871ad08db697cf8477b2b236e1810297e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0b5d764aa8f24a5e95efe003aac284070d918f326e511dee2e88a34e3ff94d703720056be7e408730aee439cc0be5d26e8c657b3922fce218ce01f75375489e
|
7
|
+
data.tar.gz: 705a4e403466b231ff18223bf8904387eb3f8aabbe7544826375c5f332b64b362ac174b2b5b8c00de2a8dfc0aacf63a66ab708ea876dd78d92ee61a27bc9c9aa
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,85 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [v3.0.0](https://github.com/faker-ruby/faker/tree/v3.0.0) (2022-11-01)
|
4
|
+
|
5
|
+
### Breaking Changes
|
6
|
+
- [PR #2576](https://github.com/faker-ruby/faker/pull/2576) Drop support for positional arguments in favor of keyword arguments. Support for positional arguments was deprecated on v2 [@mauromorales](https://github.com/mauromorales)
|
7
|
+
|
8
|
+
### Bug/Fixes
|
9
|
+
- [PR #2562](https://github.com/faker-ruby/faker/pull/2562) Fix Faker::Vehicle.vin [@rmm5t](https://github.com/rmm5t)
|
10
|
+
- [PR #2567](https://github.com/faker-ruby/faker/pull/2567) Fix typo abreviation -> abbreviation [@alextaujenis](https://github.com/alextaujenis)
|
11
|
+
- [PR #2594](https://github.com/faker-ruby/faker/pull/2594) Fix some typos [@jdufresne](https://github.com/jdufresne)
|
12
|
+
- [PR #2596](https://github.com/faker-ruby/faker/pull/2596) Removes NBSP from locales files [@hbontempo-br](https://github.com/hbontempo-br)
|
13
|
+
|
14
|
+
### Features
|
15
|
+
- [PR #2561](https://github.com/faker-ruby/faker/pull/2561) Add country code for `en-CA` phone numbers [@wjessop](https://github.com/wjessop)
|
16
|
+
- [PR #2566](https://github.com/faker-ruby/faker/pull/2566) Add color luminosity options [@fbuys](https://github.com/fbuys)
|
17
|
+
- [PR #2570](https://github.com/faker-ruby/faker/pull/2570) Add French Translation of Ancient [@Beygs](https://github.com/Beygs)
|
18
|
+
- [PR #2582](https://github.com/faker-ruby/faker/pull/2582) Add `clojure` as a language option to `Faker::Source` generator [@professorjrod](https://github.com/professorjrod)
|
19
|
+
- [PR #2585](https://github.com/faker-ruby/faker/pull/2585) Add movie Hackers [@ericdain](https://github.com/ericdain)
|
20
|
+
- [PR #2589](https://github.com/faker-ruby/faker/pull/2589) Add Game Escape From Tarkov [@professorjrod](https://github.com/professorjrod)
|
21
|
+
- [PR #2592](https://github.com/faker-ruby/faker/pull/2592) Add quotes to "no"-key [@Frubrecht](https://github.com/Frubrecht)
|
22
|
+
|
23
|
+
### What's Changed
|
24
|
+
- [PR #2549](https://github.com/faker-ruby/faker/pull/2549) Set true to `rubygems_mfa_required` gemspec metadata [@koic](https://github.com/koic)
|
25
|
+
- [PR #2557](https://github.com/faker-ruby/faker/pull/2557) Use rubocop-rake to lint Rake tasks [@dmarcoux](https://github.com/dmarcoux)
|
26
|
+
- [PR #2551](https://github.com/faker-ruby/faker/pull/2551) Security: set explicit and strict token-permissions on GitHub workflows [@sashashura](https://github.com/sashashura)
|
27
|
+
- [PR #2558](https://github.com/faker-ruby/faker/pull/2558) Remove unneeded require]() lib/faker.rb [@dmarcoux](https://github.com/dmarcoux)
|
28
|
+
- [PR #2568](https://github.com/faker-ruby/faker/pull/2568) Remove outdated comment from development dependencies [@stefannibrasil](https://github.com/stefannibrasil)
|
29
|
+
- [PR #2569](https://github.com/faker-ruby/faker/pull/2569) Improve Phone Number Locale documentation [@calvinballing](https://github.com/calvinballing)
|
30
|
+
- [PR #2579](https://github.com/faker-ruby/faker/pull/2579) Add note about Random behavior on MiniTest [@stefannibrasil](https://github.com/stefannibrasil)
|
31
|
+
- [PR #2580](https://github.com/faker-ruby/faker/pull/2580) Remove mentions to `master` and use `main` [@stefannibrasil](https://github.com/stefannibrasil)
|
32
|
+
- [PR #2586](https://github.com/faker-ruby/faker/pull/2586) Change McCree to Cassidy on Overwatch generator [@ericdain](https://github.com/ericdain)
|
33
|
+
- [PR #2584](https://github.com/faker-ruby/faker/pull/2584) Automate workflow to publish to RubyGems. [@bijoysijo](https://github.com/bijoysijo)
|
34
|
+
- [PR #2598](https://github.com/faker-ruby/faker/pull/2598) Remove tags from publish.yml [@vbrazo](https://github.com/vbrazo)
|
35
|
+
- [PR #2604](https://github.com/faker-ruby/faker/pull/2604) Update fi-FI state listing from year 1721 to 2022 [@Newman101](https://github.com/Newman101)
|
36
|
+
- [PR #2602](https://github.com/faker-ruby/faker/pull/2602) Fix publish action for release types [@thdaraujo](https://github.com/thdaraujo)
|
37
|
+
- [PR #2591](https://github.com/faker-ruby/faker/pull/2591) Fixes iban checksum calculation [@srcoley](https://github.com/srcoley)
|
38
|
+
- [PR #2599](https://github.com/faker-ruby/faker/pull/2599) Fix documentation for tarkov game [@kaushikhande](https://github.com/kaushikhande)
|
39
|
+
- [PR #2600](https://github.com/faker-ruby/faker/pull/2600) Add sports documentation and update sports [@matt17r](https://github.com/matt17r)
|
40
|
+
- [PR #2590](https://github.com/faker-ruby/faker/pull/2590) Deprecate LoremPixel [@uzorjchibuzor](https://github.com/uzorjchibuzor)
|
41
|
+
|
42
|
+
### Update local dependencies
|
43
|
+
- Update rubocop minitest to `0.23.0`
|
44
|
+
- Update simplecov to `0.21.0`
|
45
|
+
- Update test-unit to `3.5.5`
|
46
|
+
- Update rubocop to `1.37.1`
|
47
|
+
|
48
|
+
**Full Changelog**: https://github.com/faker-ruby/faker/compare/v2.23.0...v3.0.0
|
49
|
+
|
50
|
+
------------------------------------------------------------------------------
|
51
|
+
|
52
|
+
## [v2.23.0](https://github.com/faker-ruby/faker/tree/v2.23.0) (2022-09-01)
|
53
|
+
|
54
|
+
### Bug/Fixes
|
55
|
+
- [PR #2517](https://github.com/faker-ruby/faker/pull/) Fix Japanese plural [@akmhmgc](https://github.com/akmhmgc)
|
56
|
+
- [PR #2308](https://github.com/faker-ruby/faker/pull/) Internet::Password - Improve mix_case and special_characters support [@meuble](https://github.com/meuble)
|
57
|
+
- [PR #2520](https://github.com/faker-ruby/faker/pull/) Add thread safety [@kiskoza](https://github.com/kiskoza)
|
58
|
+
- [PR #2543](https://github.com/faker-ruby/faker/pull/) Fix computer test [@trinaldi](https://github.com/trinaldi)
|
59
|
+
- [PR #2552](https://github.com/faker-ruby/faker/pull/) Fix `fma_brotherhood` usage example [@y0n0zawa](https://github.com/y0n0zawa)
|
60
|
+
|
61
|
+
### Features
|
62
|
+
- [PR #2367](https://github.com/faker-ruby/faker/pull/) Add generator for vulnerability identifiers [@NobodysNightmare](https://github.com/NobodysNightmare)
|
63
|
+
- [PR #2397](https://github.com/faker-ruby/faker/pull/) Add sports to `Faker::Sport` [@matt17r](https://github.com/matt17r)
|
64
|
+
- [PR #2511](https://github.com/faker-ruby/faker/pull/) Add Danish id number [@jokklan](https://github.com/jokklan)
|
65
|
+
- [PR #2518](https://github.com/faker-ruby/faker/pull/) Add the ability to generate a mime type of a specific media type [@ric2b](https://github.com/ric2b)
|
66
|
+
- [PR #2455](https://github.com/faker-ruby/faker/pull/) Add IDNumber.french_insee_number [@Spone](https://github.com/Spone)
|
67
|
+
- [PR #2491](https://github.com/faker-ruby/faker/pull/) fix italy VAT and add italy condominium fiscal code generator [@FiloSpaTeam](https://github.com/FiloSpaTeam)
|
68
|
+
- [PR #2460](https://github.com/faker-ruby/faker/pull/) Add ChileRut.full_formatted_rut [@KarlHeitmann](https://github.com/KarlHeitmann)
|
69
|
+
- [PR #2540](https://github.com/faker-ruby/faker/pull/) Add vehicle version generator [@trinaldi](https://github.com/trinaldi)
|
70
|
+
|
71
|
+
### What's Changed
|
72
|
+
- [PR #2530](https://github.com/faker-ruby/faker/pull/) Fix flaky user agent test [@thdaraujo](https://github.com/thdaraujo)
|
73
|
+
- [PR #2531](https://github.com/faker-ruby/faker/pull/) Update GitHub Issues and Pull Request Templates [ci-skip] [@stefannibrasil](https://github.com/stefannibrasil)
|
74
|
+
- [PR #2535](https://github.com/faker-ruby/faker/pull/) Fix warning instance variable uninitialized [@akmhmgc](https://github.com/akmhmgc)
|
75
|
+
- [PR #2536](https://github.com/faker-ruby/faker/pull/) Updated versions and added more operating systems [@abrahamparayil](https://github.com/abrahamparayil)
|
76
|
+
- [PR #2538](https://github.com/faker-ruby/faker/pull/) Drop support for EOL Ruby versions (`2.5` and `2.6`) [@nickmendezFlatiron](https://github.com/nickmendezFlatiron)
|
77
|
+
|
78
|
+
### Update local dependencies
|
79
|
+
- Update minitest to `5.16.3`
|
80
|
+
- Update rubocop to `1.35.1`
|
81
|
+
|
82
|
+
------------------------------------------------------------------------------
|
2
83
|
|
3
84
|
## [v2.22.0](https://github.com/faker-ruby/faker/tree/v2.22.0) (2022-07-28)
|
4
85
|
|
@@ -399,7 +480,7 @@ This version:
|
|
399
480
|
## Bug/Fixes
|
400
481
|
|
401
482
|
- [PR #2050](https://github.com/faker-ruby/faker/pull/2050) Fix random error in music tests [@martinjaimem](https://github.com/martinjaimem)
|
402
|
-
- [PR #2037](https://github.com/faker-ruby/faker/pull/2037) Bug Fix: BIC
|
483
|
+
- [PR #2037](https://github.com/faker-ruby/faker/pull/2037) Bug Fix: BIC Collision (Issue 1907) [@Newman101](https://github.com/Newman101)
|
403
484
|
- [PR #2026](https://github.com/faker-ruby/faker/pull/2026) Sanitize email when name has special characters [@Zeragamba](https://github.com/Zeragamba)
|
404
485
|
- [PR #1785](https://github.com/faker-ruby/faker/pull/1785) Adds a fix for when :en is not one of the available locales [@jaimerodas](https://github.com/jaimerodas)
|
405
486
|
|
@@ -1140,7 +1221,7 @@ Version 2 has several `breaking changes`. We replaced positional arguments with
|
|
1140
1221
|
- `Faker::Types.rb_integer(from = nil, to = nil)` becomes `Faker::Types.rb_integer(from: nil, to: nil)`
|
1141
1222
|
- `Faker::Types.rb_string(words = nil)` becomes `Faker::Types.rb_string(words: nil)`
|
1142
1223
|
- `Faker::Vehicle.kilometrage(min = nil, max = nil)` becomes `Faker::Vehicle.kilometrage(min: nil, max: nil)`
|
1143
|
-
- `Faker::Vehicle.license_plate(
|
1224
|
+
- `Faker::Vehicle.license_plate(state_abbreviation = nil)` becomes `Faker::Vehicle.license_plate(state_abbreviation: nil)`
|
1144
1225
|
- `Faker::Vehicle.mileage(min = nil, max = nil)` becomes `Faker::Vehicle.mileage(min: nil, max: nil)`
|
1145
1226
|
- `Faker::Vehicle.model(make_of_model = nil)` becomes `Faker::Vehicle.model(make_of_model: nil)`
|
1146
1227
|
- `Faker::WorldCup.group(group = nil)` becomes `Faker::WorldCup.group(group: nil)`
|
@@ -1249,7 +1330,7 @@ Fix lib/faker/version.rb
|
|
1249
1330
|
|
1250
1331
|
### Update/add locales
|
1251
1332
|
|
1252
|
-
- [PR #1629](https://github.com/stympy/faker/pull/1629) Fix
|
1333
|
+
- [PR #1629](https://github.com/stympy/faker/pull/1629) Fix syntax error on game.yml file [@ricardobsilva](https://github.com/ricardobsilva)
|
1253
1334
|
- [PR #1627](https://github.com/stympy/faker/pull/1627) add more data for Faker::Games [@BlazingRockStorm](https://github.com/BlazingRockStorm)
|
1254
1335
|
- [PR #1620](https://github.com/stympy/faker/pull/1620) Added Yuumi as a Champion [@eddorre](https://github.com/eddorre)
|
1255
1336
|
- [PR #1621](https://github.com/stympy/faker/pull/1621) Updated classes to match the changes that Blizzard rolled out late last year. Updated hero pool to add the latest two heroes added to the game. [@eddorre](https://github.com/eddorre)
|
@@ -1512,7 +1593,7 @@ Fix lib/faker/version.rb
|
|
1512
1593
|
- [PR #1220](https://github.com/stympy/faker/pull/1220) Updates for Faker::Myst [@SpyMaster356](https://github.com/SpyMaster356)
|
1513
1594
|
- [PR #1218](https://github.com/stympy/faker/pull/1218) Add Faker::Myst [@SpyMaster356](https://github.com/SpyMaster356)
|
1514
1595
|
- [PR #818](https://github.com/stympy/faker/pull/818) LoremFlickr support [@mrstebo](https://github.com/mrstebo)
|
1515
|
-
- [PR #1192](https://github.com/stympy/faker/pull/1192) Space: Added space launch
|
1596
|
+
- [PR #1192](https://github.com/stympy/faker/pull/1192) Space: Added space launch vehicle [@gauth-ier](https://github.com/Gauth-ier)
|
1516
1597
|
- [PR #1211](https://github.com/stympy/faker/pull/1211) Add bands, genres, and albums to Music [@jmkoni](https://github.com/jmkoni)
|
1517
1598
|
- [PR #1215](https://github.com/stympy/faker/pull/1215) Added Nato Phonetic Alphabet [@timcustard](https://github.com/timcustard)
|
1518
1599
|
- [PR #1209](https://github.com/stympy/faker/pull/1209) Add Faker::Source [@graciano](https://github.com/graciano)
|
@@ -1632,7 +1713,7 @@ Fix lib/faker/version.rb
|
|
1632
1713
|
|
1633
1714
|
**Other changes**
|
1634
1715
|
|
1635
|
-
- Changed i18n
|
1716
|
+
- Changed i18n dependency from `~> 0.9.1` to `>= 0.7`
|
1636
1717
|
|
1637
1718
|
## [v1.8.5](https://github.com/stympy/faker/tree/v1.8.5) (2017-12-06)
|
1638
1719
|
[Full Changelog](https://github.com/stympy/faker/compare/v1.8.4...v1.8.5)
|
@@ -2128,7 +2209,7 @@ Fix lib/faker/version.rb
|
|
2128
2209
|
* Added bork locale for bork-ified lorem [johnbentcope]
|
2129
2210
|
* Added IPv6 address generator [jc00ke]
|
2130
2211
|
* Removed deprecation warnings for Array#rand [chrismarshall]
|
2131
|
-
* Added German translation and I18n
|
2212
|
+
* Added German translation and I18n improvements [Matthias Kühnert]
|
2132
2213
|
* Added Dutch translation [moretea]
|
2133
2214
|
* Added Lat/Long generator [Andy Callaghan]
|
2134
2215
|
* Added buzzword-laden title generator [supercleanse]
|
data/History.md
CHANGED
@@ -104,7 +104,7 @@
|
|
104
104
|
* Added bork locale for bork-ified lorem [johnbentcope]
|
105
105
|
* Added IPv6 address generator [jc00ke]
|
106
106
|
* Removed deprecation warnings for Array#rand [chrismarshall]
|
107
|
-
* Added German translation and I18n
|
107
|
+
* Added German translation and I18n improvements [Matthias Kühnert]
|
108
108
|
* Added Dutch translation [moretea]
|
109
109
|
* Added Lat/Long generator [Andy Callaghan]
|
110
110
|
* Added buzzword-laden title generator [supercleanse]
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# Faker
|
4
4
|
[](https://github.com/faker-ruby/faker/actions?query=workflow%3ATests)
|
5
5
|
[](https://badge.fury.io/rb/faker)
|
6
|
-
[](https://inch-ci.org/github/faker-ruby/faker)
|
7
7
|
[](https://codeclimate.com/github/stympy/faker/test_coverage)
|
8
8
|
[](https://codeclimate.com/github/stympy/faker/maintainability)
|
9
9
|
|
@@ -44,7 +44,9 @@ development.
|
|
44
44
|
* While Faker generates data at random, returned values are not guaranteed to be unique by default.
|
45
45
|
You must explicitly specify when you require unique values, see [details](#ensuring-unique-values).
|
46
46
|
Values also can be deterministic if you use the deterministic feature, see [details](#deterministic-random)
|
47
|
-
*
|
47
|
+
* Minitest and Faker >= 2.22 users might need to add the following to the `test_helper.rb` or `rails_helper.rb` file:
|
48
|
+
`Faker::Config.random = Random.new`. See [Issue #2534](https://github.com/faker-ruby/faker/issues/2534) for more details.
|
49
|
+
* This is the `main` branch of Faker and may contain changes that are not yet released.
|
48
50
|
Please refer the README of your version for the available methods.
|
49
51
|
List of all versions is [available here](https://github.com/stympy/faker/releases).
|
50
52
|
|
@@ -55,7 +57,7 @@ gem install faker
|
|
55
57
|
Note: if you are getting a `uninitialized constant Faker::[some_class]` error, your version of the gem is behind the one documented here. To make sure that your gem is the one documented here, change the line in your Gemfile to:
|
56
58
|
|
57
59
|
```ruby
|
58
|
-
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => '
|
60
|
+
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main'
|
59
61
|
```
|
60
62
|
|
61
63
|
## Usage
|
@@ -117,7 +119,7 @@ Faker::Company.bs #=> "cultivate viral synergies"
|
|
117
119
|
**NOTE: Some of the generators below aren't released yet. If you want to use them, change the line in your gemfile to:**
|
118
120
|
|
119
121
|
```ruby
|
120
|
-
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => '
|
122
|
+
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main'
|
121
123
|
```
|
122
124
|
|
123
125
|
### Default
|
@@ -217,6 +219,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
217
219
|
- [Faker::University](doc/default/university.md)
|
218
220
|
- [Faker::Vehicle](doc/default/vehicle.md)
|
219
221
|
- [Faker::Verbs](doc/default/verbs.md)
|
222
|
+
- [Faker::VulnerabilityIdentifier](doc/default/vulnerability_identifier.md)
|
220
223
|
- [Faker::WorldCup](doc/default/world_cup.md)
|
221
224
|
|
222
225
|
### Blockchain
|
@@ -313,8 +316,11 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
313
316
|
|
314
317
|
|
315
318
|
### Sports
|
319
|
+
- [Faker::Sports](doc/sports/sports.md)
|
316
320
|
- [Faker::Sports::Basketball](doc/sports/basketball.md)
|
317
321
|
- [Faker::Sports::Football](doc/sports/football.md)
|
322
|
+
- [Faker::Sports::Mountaineering](doc/sports/mountaineering.md)
|
323
|
+
- [Faker::Sports::Volleyball](doc/sports/volleyball.md)
|
318
324
|
|
319
325
|
### Tv Shows
|
320
326
|
- [Faker::TvShows::AquaTeenHungerForce](doc/tv_shows/aqua_teen_hunger_force.md)
|
@@ -399,7 +405,7 @@ en-au-ocker:
|
|
399
405
|
```
|
400
406
|
|
401
407
|
## Contributing
|
402
|
-
See [CONTRIBUTING.md](https://github.com/stympy/faker/blob/
|
408
|
+
See [CONTRIBUTING.md](https://github.com/stympy/faker/blob/main/CONTRIBUTING.md).
|
403
409
|
|
404
410
|
## Contact
|
405
411
|
Comments and feedback are welcome. Send an email to Benjamin Curtis via the [google group](http://groups.google.com/group/ruby-faker).
|
@@ -61,7 +61,7 @@ module Faker
|
|
61
61
|
def rand_strings(length = 50)
|
62
62
|
hex_alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
63
63
|
var = +''
|
64
|
-
length.times { var << sample(shuffle(hex_alphabet.
|
64
|
+
length.times { var << sample(shuffle(hex_alphabet.chars)) }
|
65
65
|
var
|
66
66
|
end
|
67
67
|
end
|
@@ -125,7 +125,7 @@ module Faker
|
|
125
125
|
# @return [String]
|
126
126
|
def encode_tz(prefix, payload_size)
|
127
127
|
prefix = PREFIXES.fetch(prefix)
|
128
|
-
packed = prefix.map(&:chr).join
|
128
|
+
packed = prefix.map(&:chr).join + Faker::Config.random.bytes(payload_size)
|
129
129
|
checksum = OpenSSL::Digest::SHA256.digest(OpenSSL::Digest::SHA256.digest(packed))[0..3]
|
130
130
|
Faker::Base58.encode(packed + checksum)
|
131
131
|
end
|
data/lib/faker/books/dune.rb
CHANGED
@@ -71,11 +71,7 @@ module Faker
|
|
71
71
|
# #=> "He who controls the spice, controls the universe!"
|
72
72
|
#
|
73
73
|
# @faker.version 1.9.3
|
74
|
-
def quote(
|
75
|
-
warn_for_deprecated_arguments do |keywords|
|
76
|
-
keywords << :character if legacy_character != NOT_GIVEN
|
77
|
-
end
|
78
|
-
|
74
|
+
def quote(character: nil)
|
79
75
|
quoted_characters = translate('faker.dune.quotes').keys
|
80
76
|
|
81
77
|
if character.nil?
|
@@ -106,11 +102,7 @@ module Faker
|
|
106
102
|
# #=> "May thy knife chip and shatter."
|
107
103
|
#
|
108
104
|
# @faker.version 1.9.3
|
109
|
-
def saying(
|
110
|
-
warn_for_deprecated_arguments do |keywords|
|
111
|
-
keywords << :source if legacy_source != NOT_GIVEN
|
112
|
-
end
|
113
|
-
|
105
|
+
def saying(source: nil)
|
114
106
|
sourced_sayings = translate('faker.dune.sayings').keys
|
115
107
|
|
116
108
|
if source.nil?
|
@@ -29,11 +29,7 @@ module Faker
|
|
29
29
|
# #=> "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fht...
|
30
30
|
#
|
31
31
|
# @faker.version 1.9.3
|
32
|
-
def fhtagn(
|
33
|
-
warn_for_deprecated_arguments do |keywords|
|
34
|
-
keywords << :number if legacy_number != NOT_GIVEN
|
35
|
-
end
|
36
|
-
|
32
|
+
def fhtagn(number: 1)
|
37
33
|
Array.new(number) { fetch('lovecraft.fhtagn') }.join('. ')
|
38
34
|
end
|
39
35
|
|
@@ -86,12 +82,7 @@ module Faker
|
|
86
82
|
# #=> "Effulgence unmentionable gambrel."
|
87
83
|
#
|
88
84
|
# @faker.version 1.9.3
|
89
|
-
def sentence(
|
90
|
-
warn_for_deprecated_arguments do |keywords|
|
91
|
-
keywords << :word_count if legacy_word_count != NOT_GIVEN
|
92
|
-
keywords << :random_words_to_add if legacy_random_words_to_add != NOT_GIVEN
|
93
|
-
end
|
94
|
-
|
85
|
+
def sentence(word_count: 4, random_words_to_add: 6, open_compounds_allowed: true)
|
95
86
|
"#{words(number: word_count + rand(random_words_to_add.to_i).to_i, spaces_allowed: open_compounds_allowed).join(' ').capitalize}."
|
96
87
|
end
|
97
88
|
|
@@ -138,12 +129,7 @@ module Faker
|
|
138
129
|
# # ]
|
139
130
|
#
|
140
131
|
# @faker.version 1.9.3
|
141
|
-
def words(
|
142
|
-
warn_for_deprecated_arguments do |keywords|
|
143
|
-
keywords << :number if legacy_number != NOT_GIVEN
|
144
|
-
keywords << :spaces_allowed if legacy_spaces_allowed != NOT_GIVEN
|
145
|
-
end
|
146
|
-
|
132
|
+
def words(number: 3, spaces_allowed: false)
|
147
133
|
resolved_num = resolve(number)
|
148
134
|
word_list = translate('faker.lovecraft.words')
|
149
135
|
word_list *= ((resolved_num / word_list.length) + 1)
|
@@ -176,11 +162,7 @@ module Faker
|
|
176
162
|
# # ]
|
177
163
|
#
|
178
164
|
# @faker.version 1.9.3
|
179
|
-
def sentences(
|
180
|
-
warn_for_deprecated_arguments do |keywords|
|
181
|
-
keywords << :number if legacy_number != NOT_GIVEN
|
182
|
-
end
|
183
|
-
|
165
|
+
def sentences(number: 3)
|
184
166
|
[].tap do |sentences|
|
185
167
|
1.upto(resolve(number)) do
|
186
168
|
sentences << sentence(word_count: 3)
|
@@ -207,12 +189,7 @@ module Faker
|
|
207
189
|
# #=> "Stench cyclopean fainted antiquarian nameless. Antiquarian ululate tenebrous non-euclidean effulgence."
|
208
190
|
#
|
209
191
|
# @faker.version 1.9.3
|
210
|
-
def paragraph(
|
211
|
-
warn_for_deprecated_arguments do |keywords|
|
212
|
-
keywords << :sentence_count if legacy_sentence_count != NOT_GIVEN
|
213
|
-
keywords << :random_sentences_to_add if legacy_random_sentences_to_add != NOT_GIVEN
|
214
|
-
end
|
215
|
-
|
192
|
+
def paragraph(sentence_count: 3, random_sentences_to_add: 3)
|
216
193
|
sentences(number: resolve(sentence_count) + rand(random_sentences_to_add.to_i).to_i).join(' ')
|
217
194
|
end
|
218
195
|
|
@@ -238,11 +215,7 @@ module Faker
|
|
238
215
|
# # ]
|
239
216
|
#
|
240
217
|
# @faker.version 1.9.3
|
241
|
-
def paragraphs(
|
242
|
-
warn_for_deprecated_arguments do |keywords|
|
243
|
-
keywords << :number if legacy_number != NOT_GIVEN
|
244
|
-
end
|
245
|
-
|
218
|
+
def paragraphs(number: 3)
|
246
219
|
[].tap do |paragraphs|
|
247
220
|
1.upto(resolve(number)) do
|
248
221
|
paragraphs << paragraph(sentence_count: 3)
|
@@ -263,11 +236,7 @@ module Faker
|
|
263
236
|
# #=> "Effulgence madness noisome. Fungus stygian mortal madness amorphous dank. Decadent noisome hideous effulgence. Tentacles charne."
|
264
237
|
#
|
265
238
|
# @faker.version 1.9.3
|
266
|
-
def paragraph_by_chars(
|
267
|
-
warn_for_deprecated_arguments do |keywords|
|
268
|
-
keywords << :characters if legacy_characters != NOT_GIVEN
|
269
|
-
end
|
270
|
-
|
239
|
+
def paragraph_by_chars(characters: 256)
|
271
240
|
paragraph = paragraph(sentence_count: 3)
|
272
241
|
|
273
242
|
paragraph += " #{paragraph(sentence_count: 3)}" while paragraph.length < characters
|
@@ -18,11 +18,7 @@ module Faker
|
|
18
18
|
# #=> "Northfort, California"
|
19
19
|
#
|
20
20
|
# @faker.version 0.3.0
|
21
|
-
def city(
|
22
|
-
warn_for_deprecated_arguments do |keywords|
|
23
|
-
keywords << :options if legacy_options != NOT_GIVEN
|
24
|
-
end
|
25
|
-
|
21
|
+
def city(options: {})
|
26
22
|
parse(options[:with_state] ? 'address.city_with_state' : 'address.city')
|
27
23
|
end
|
28
24
|
|
@@ -49,11 +45,7 @@ module Faker
|
|
49
45
|
# Faker::Address.street_address #=> "282 Kevin Brook"
|
50
46
|
#
|
51
47
|
# @faker.version 0.3.0
|
52
|
-
def street_address(
|
53
|
-
warn_for_deprecated_arguments do |keywords|
|
54
|
-
keywords << :include_secondary if legacy_include_secondary != NOT_GIVEN
|
55
|
-
end
|
56
|
-
|
48
|
+
def street_address(include_secondary: false)
|
57
49
|
numerify(parse('address.street_address') + (include_secondary ? " #{secondary_address}" : ''))
|
58
50
|
end
|
59
51
|
|
@@ -121,11 +113,7 @@ module Faker
|
|
121
113
|
# Faker::Address.zip_code(state_abbreviation: 'CO') #=> "80011"
|
122
114
|
#
|
123
115
|
# @faker.version 0.3.0
|
124
|
-
def zip_code(
|
125
|
-
warn_for_deprecated_arguments do |keywords|
|
126
|
-
keywords << :state_abbreviation if legacy_state_abbreviation != NOT_GIVEN
|
127
|
-
end
|
128
|
-
|
116
|
+
def zip_code(state_abbreviation: '')
|
129
117
|
if state_abbreviation.empty?
|
130
118
|
letterified_string = letterify(fetch('address.postcode'))
|
131
119
|
return numerify(letterified_string, leading_zero: true)
|
@@ -242,11 +230,7 @@ module Faker
|
|
242
230
|
# Faker::Address.country_by_code(code: 'NL') #=> "Netherlands"
|
243
231
|
#
|
244
232
|
# @faker.version 1.9.2
|
245
|
-
def country_by_code(
|
246
|
-
warn_for_deprecated_arguments do |keywords|
|
247
|
-
keywords << :code if legacy_code != NOT_GIVEN
|
248
|
-
end
|
249
|
-
|
233
|
+
def country_by_code(code: 'US')
|
250
234
|
fetch("address.country_by_code.#{code}")
|
251
235
|
end
|
252
236
|
|
@@ -260,11 +244,7 @@ module Faker
|
|
260
244
|
# Faker::Address.country_name_to_code(name: 'united_states') #=> "US"
|
261
245
|
#
|
262
246
|
# @faker.version 1.9.2
|
263
|
-
def country_name_to_code(
|
264
|
-
warn_for_deprecated_arguments do |keywords|
|
265
|
-
keywords << :name if legacy_name != NOT_GIVEN
|
266
|
-
end
|
267
|
-
|
247
|
+
def country_name_to_code(name: 'united_states')
|
268
248
|
fetch("address.country_by_name.#{name}")
|
269
249
|
end
|
270
250
|
|
@@ -19,10 +19,7 @@ module Faker
|
|
19
19
|
# Faker::Alphanumeric.alpha(number: 10) #=> "zlvubkrwga"
|
20
20
|
#
|
21
21
|
# @faker.version 1.9.2
|
22
|
-
def alpha(
|
23
|
-
warn_for_deprecated_arguments do |keywords|
|
24
|
-
keywords << :number if legacy_number != NOT_GIVEN
|
25
|
-
end
|
22
|
+
def alpha(number: 32)
|
26
23
|
char_count = resolve(number)
|
27
24
|
return '' if char_count.to_i < 1
|
28
25
|
|
@@ -46,10 +43,7 @@ module Faker
|
|
46
43
|
# Faker::Alphanumeric.alphanumeric(number: 10, min_alpha: 3, min_numeric: 3) #=> "3yfq2phx8b"
|
47
44
|
#
|
48
45
|
# @faker.version 2.1.3
|
49
|
-
def alphanumeric(
|
50
|
-
warn_for_deprecated_arguments do |keywords|
|
51
|
-
keywords << :number if legacy_number != NOT_GIVEN
|
52
|
-
end
|
46
|
+
def alphanumeric(number: 32, min_alpha: 0, min_numeric: 0)
|
53
47
|
char_count = resolve(number)
|
54
48
|
return '' if char_count.to_i < 1
|
55
49
|
raise ArgumentError, 'min_alpha must be greater than or equal to 0' if min_alpha&.negative?
|
data/lib/faker/default/app.rb
CHANGED
@@ -42,8 +42,6 @@ module Faker
|
|
42
42
|
parse('app.author')
|
43
43
|
end
|
44
44
|
|
45
|
-
# rubocop:disable Metrics/ParameterLists
|
46
|
-
|
47
45
|
##
|
48
46
|
# Produces a String representing a semantic version identifier.
|
49
47
|
#
|
@@ -62,16 +60,9 @@ module Faker
|
|
62
60
|
# Faker::App.semantic_version(patch: 5..6) #=> "7.2.6"
|
63
61
|
#
|
64
62
|
# @faker.version 1.4.3
|
65
|
-
def semantic_version(
|
66
|
-
warn_for_deprecated_arguments do |keywords|
|
67
|
-
keywords << :major if legacy_major != NOT_GIVEN
|
68
|
-
keywords << :minor if legacy_minor != NOT_GIVEN
|
69
|
-
keywords << :patch if legacy_patch != NOT_GIVEN
|
70
|
-
end
|
71
|
-
|
63
|
+
def semantic_version(major: 0..9, minor: 0..9, patch: 1..9)
|
72
64
|
[major, minor, patch].map { |chunk| sample(Array(chunk)) }.join('.')
|
73
65
|
end
|
74
|
-
# rubocop:enable Metrics/ParameterLists
|
75
66
|
end
|
76
67
|
end
|
77
68
|
end
|
data/lib/faker/default/avatar.rb
CHANGED
@@ -6,8 +6,6 @@ module Faker
|
|
6
6
|
# @private
|
7
7
|
SUPPORTED_FORMATS = %w[png jpg bmp].freeze
|
8
8
|
|
9
|
-
# rubocop:disable Metrics/ParameterLists
|
10
|
-
|
11
9
|
##
|
12
10
|
# Produces a URL for an avatar from robohash.org
|
13
11
|
#
|
@@ -38,15 +36,7 @@ module Faker
|
|
38
36
|
# #=> "https://robohash.org/my-own-slug.bmp?size=50x50&set=set1&bgset=bg1"
|
39
37
|
#
|
40
38
|
# @faker.version 1.4.3
|
41
|
-
def image(
|
42
|
-
warn_for_deprecated_arguments do |keywords|
|
43
|
-
keywords << :slug if legacy_slug != NOT_GIVEN
|
44
|
-
keywords << :size if legacy_size != NOT_GIVEN
|
45
|
-
keywords << :format if legacy_format != NOT_GIVEN
|
46
|
-
keywords << :set if legacy_set != NOT_GIVEN
|
47
|
-
keywords << :bgset if legacy_bgset != NOT_GIVEN
|
48
|
-
end
|
49
|
-
|
39
|
+
def image(slug: nil, size: '300x300', format: 'png', set: 'set1', bgset: nil)
|
50
40
|
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
|
51
41
|
raise ArgumentError, "Supported formats are #{SUPPORTED_FORMATS.join(', ')}" unless SUPPORTED_FORMATS.include?(format)
|
52
42
|
|
@@ -54,7 +44,6 @@ module Faker
|
|
54
44
|
bgset_query = "&bgset=#{bgset}" if bgset
|
55
45
|
"https://robohash.org/#{slug}.#{format}?size=#{size}&set=#{set}#{bgset_query}"
|
56
46
|
end
|
57
|
-
# rubocop:enable Metrics/ParameterLists
|
58
47
|
end
|
59
48
|
end
|
60
49
|
end
|
data/lib/faker/default/bank.rb
CHANGED
@@ -16,14 +16,10 @@ module Faker
|
|
16
16
|
# Faker::Bank.account_number(digits: 13) #=> 673858237902
|
17
17
|
#
|
18
18
|
# @faker.version 1.9.1
|
19
|
-
def account_number(
|
20
|
-
warn_for_deprecated_arguments do |keywords|
|
21
|
-
keywords << :digits if legacy_digits != NOT_GIVEN
|
22
|
-
end
|
23
|
-
|
19
|
+
def account_number(digits: 10)
|
24
20
|
output = ''
|
25
21
|
|
26
|
-
output += rand.to_s[2
|
22
|
+
output += rand.to_s[2..] while output.length < digits
|
27
23
|
|
28
24
|
output[0...digits]
|
29
25
|
end
|
@@ -40,14 +36,10 @@ module Faker
|
|
40
36
|
# Faker::Bank.iban(country_code: nil) #=> "DE45186738071857270067"
|
41
37
|
#
|
42
38
|
# @faker.version 1.7.0
|
43
|
-
def iban(
|
39
|
+
def iban(country_code: 'GB')
|
44
40
|
# Each country has its own format for bank accounts
|
45
41
|
# Many of them use letters in certain parts of the account
|
46
42
|
# Using regex patterns we can create virtually any type of bank account
|
47
|
-
warn_for_deprecated_arguments do |keywords|
|
48
|
-
keywords << :country_code if legacy_country_code != NOT_GIVEN
|
49
|
-
end
|
50
|
-
|
51
43
|
country_code ||= iban_country_code
|
52
44
|
|
53
45
|
begin
|
@@ -145,7 +137,7 @@ module Faker
|
|
145
137
|
private
|
146
138
|
|
147
139
|
def checksum(num_string)
|
148
|
-
num_array = num_string.
|
140
|
+
num_array = num_string.chars.map(&:to_i)
|
149
141
|
(
|
150
142
|
7 * (num_array[0] + num_array[3] + num_array[6]) +
|
151
143
|
3 * (num_array[1] + num_array[4] + num_array[7]) +
|
@@ -166,15 +158,15 @@ module Faker
|
|
166
158
|
end
|
167
159
|
|
168
160
|
# Calculates the mandatory checksum in 3rd and 4th characters in IBAN format
|
169
|
-
# source: https://en.wikipedia.org/wiki/International_Bank_Account_Number#
|
161
|
+
# source: https://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits
|
170
162
|
def iban_checksum(country_code, account)
|
171
163
|
# Converts letters to numbers according the iban rules, A=10..Z=35
|
172
164
|
account_to_number = "#{account}#{country_code}00".upcase.chars.map do |d|
|
173
165
|
d =~ /[A-Z]/ ? (d.ord - 55).to_s : d
|
174
166
|
end.join.to_i
|
175
167
|
|
176
|
-
# This is answer to (iban_to_num + checksum) % 97 == 1
|
177
|
-
checksum =
|
168
|
+
# This is the correct answer to (iban_to_num + checksum) % 97 == 1
|
169
|
+
checksum = 98 - (account_to_number % 97)
|
178
170
|
|
179
171
|
# Use leftpad to make the size always to 2
|
180
172
|
checksum.to_s.rjust(2, '0')
|
@@ -194,8 +186,8 @@ module Faker
|
|
194
186
|
|
195
187
|
def compile_fraction(routing_num)
|
196
188
|
prefix = (1..50).to_a.map(&:to_s).sample
|
197
|
-
numerator = routing_num.
|
198
|
-
denominator = routing_num.
|
189
|
+
numerator = routing_num.chars[5..8].join.to_i.to_s
|
190
|
+
denominator = routing_num.chars[0..4].join.to_i.to_s
|
199
191
|
"#{prefix}-#{numerator}/#{denominator}"
|
200
192
|
end
|
201
193
|
|
@@ -15,10 +15,7 @@ module Faker
|
|
15
15
|
# Faker::Boolean.boolean(true_ratio: 0.2) #=> false
|
16
16
|
#
|
17
17
|
# @faker.version 1.6.2
|
18
|
-
def boolean(
|
19
|
-
warn_for_deprecated_arguments do |keywords|
|
20
|
-
keywords << :true_ratio if legacy_true_ratio != NOT_GIVEN
|
21
|
-
end
|
18
|
+
def boolean(true_ratio: 0.5)
|
22
19
|
(rand < true_ratio)
|
23
20
|
end
|
24
21
|
end
|