faker 2.19.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +346 -7
- data/History.md +1 -1
- data/README.md +198 -104
- 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/books/the_kingkiller_chronicle.rb +61 -0
- 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 +11 -24
- data/lib/faker/default/color.rb +77 -6
- data/lib/faker/default/commerce.rb +3 -17
- data/lib/faker/default/company.rb +23 -20
- 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/drone.rb +1 -1
- data/lib/faker/default/file.rb +5 -24
- data/lib/faker/default/finance.rb +17 -7
- data/lib/faker/default/food.rb +14 -1
- data/lib/faker/default/hipster.rb +6 -45
- data/lib/faker/default/id_number.rb +108 -11
- data/lib/faker/default/internet.rb +168 -129
- data/lib/faker/default/invoice.rb +4 -17
- data/lib/faker/default/json.rb +2 -20
- data/lib/faker/default/lorem.rb +20 -76
- data/lib/faker/default/lorem_flickr.rb +4 -32
- data/lib/faker/default/markdown.rb +6 -11
- data/lib/faker/default/marketing.rb +1 -1
- data/lib/faker/default/measurement.rb +16 -48
- data/lib/faker/default/name.rb +1 -5
- data/lib/faker/default/nation.rb +0 -3
- data/lib/faker/default/nhs.rb +2 -6
- data/lib/faker/default/number.rb +10 -55
- data/lib/faker/default/omniauth.rb +51 -41
- data/lib/faker/default/phone_number.rb +2 -6
- data/lib/faker/default/placeholdit.rb +1 -12
- data/lib/faker/default/relationship.rb +1 -5
- data/lib/faker/default/religion.rb +6 -0
- data/lib/faker/default/source.rb +3 -16
- data/lib/faker/default/string.rb +1 -8
- data/lib/faker/default/stripe.rb +4 -20
- data/lib/faker/default/time.rb +4 -34
- data/lib/faker/default/twitter.rb +7 -23
- data/lib/faker/default/types.rb +5 -27
- data/lib/faker/default/vehicle.rb +29 -51
- data/lib/faker/default/vulnerability_identifier.rb +23 -0
- data/lib/faker/default/world_cup.rb +2 -11
- data/lib/faker/games/clash_of_clans.rb +1 -1
- data/lib/faker/games/dnd.rb +49 -7
- data/lib/faker/games/dota.rb +1 -5
- data/lib/faker/games/minecraft.rb +1 -1
- data/lib/faker/games/myst.rb +1 -1
- data/lib/faker/games/tarkov.rb +205 -0
- data/lib/faker/japanese_media/cowboy_bebop.rb +61 -0
- data/lib/faker/japanese_media/fullmetal_alchemist_brotherhood.rb +48 -0
- data/lib/faker/japanese_media/kamen_rider.rb +102 -0
- data/lib/faker/japanese_media/one_piece.rb +1 -1
- data/lib/faker/movies/avatar.rb +49 -0
- data/lib/faker/movies/hackers.rb +48 -0
- data/lib/faker/movies/star_wars.rb +1 -5
- data/lib/faker/movies/tron.rb +161 -0
- data/lib/faker/quotes/quote.rb +13 -0
- data/lib/faker/religion/bible.rb +50 -0
- data/lib/faker/sports/chess.rb +90 -0
- data/lib/faker/sports/mountaineering.rb +22 -0
- data/lib/faker/sports/sport.rb +116 -0
- data/lib/faker/travel/airport.rb +43 -0
- data/lib/faker/tv_shows/brooklyn_nine_nine.rb +38 -0
- data/lib/faker/tv_shows/michael_scott.rb +0 -3
- data/lib/faker/tv_shows/spongebob.rb +50 -0
- data/lib/faker/version.rb +1 -1
- data/lib/faker.rb +15 -64
- data/lib/helpers/base58.rb +1 -1
- data/lib/helpers/unique_generator.rb +13 -11
- data/lib/locales/ar.yml +6 -1
- data/lib/locales/bg.yml +1 -1
- data/lib/locales/da-DK.yml +1 -1
- data/lib/locales/de-AT.yml +3 -4
- data/lib/locales/de-CH.yml +1 -1
- data/lib/locales/de.yml +1 -1
- data/lib/locales/en/address.yml +2 -3
- data/lib/locales/en/airport.yml +381 -0
- data/lib/locales/en/australia.yml +3 -4
- data/lib/locales/en/avatar.yml +31 -0
- data/lib/locales/en/bible.yml +90 -0
- data/lib/locales/en/brooklyn_nine_nine.yml +35 -0
- data/lib/locales/en/cat.yml +1 -1
- data/lib/locales/en/chess.yml +103 -0
- data/lib/locales/en/coffee.yml +1 -1
- data/lib/locales/en/company.yml +1 -0
- data/lib/locales/en/computer.yml +23 -4
- data/lib/locales/en/cowboy_bebop.yml +163 -0
- data/lib/locales/en/dnd.yml +186 -1
- data/lib/locales/en/dota.yml +113 -0
- data/lib/locales/en/file.yml +9 -1
- data/lib/locales/en/finance.yml +3 -1
- data/lib/locales/en/fma_brotherhood.yml +78 -0
- data/lib/locales/en/food.yml +12 -0
- data/lib/locales/en/game.yml +11 -0
- data/lib/locales/en/hackers.yml +53 -0
- data/lib/locales/en/heroes.yml +2 -2
- data/lib/locales/en/internet.yml +140 -3
- data/lib/locales/en/kamen_rider.yml +452 -0
- data/lib/locales/en/mitch_hedberg.yml +46 -0
- data/lib/locales/en/mountain.yml +14 -1
- data/lib/locales/en/mountaineering.yml +14 -0
- data/lib/locales/en/movie.yml +2 -1
- data/lib/locales/en/naruto.yml +2 -3
- 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/spongebob.yml +489 -0
- data/lib/locales/en/sport.yml +130 -0
- data/lib/locales/en/star_wars.yml +1 -1
- data/lib/locales/en/stranger_thing.yml +1 -1
- data/lib/locales/en/super_smash_bros.yml +2 -0
- data/lib/locales/en/tarkov.yml +593 -0
- data/lib/locales/en/the_kingkiller_chronicle.yml +56 -0
- data/lib/locales/en/tron.yml +227 -0
- data/lib/locales/en/vehicle.yml +2809 -75
- data/lib/locales/en-AU.yml +2 -2
- data/lib/locales/en-CA.yml +2 -1
- data/lib/locales/en-GB.yml +2 -1
- data/lib/locales/en-MS.yml +1 -0
- data/lib/locales/en-NG.yml +1 -0
- data/lib/locales/en-NZ.yml +1 -0
- data/lib/locales/en-PAK.yml +1 -0
- data/lib/locales/en-SG.yml +1 -0
- data/lib/locales/en-UG.yml +1 -0
- data/lib/locales/en-US.yml +2 -2
- data/lib/locales/en-ZA.yml +1 -1
- data/lib/locales/en-au-ocker.yml +2 -0
- data/lib/locales/es-AR.yml +3 -2
- data/lib/locales/es-MX.yml +1 -1
- data/lib/locales/es.yml +2 -2
- data/lib/locales/fi-FI.yml +3 -1
- data/lib/locales/fr/address.yml +0 -1
- data/lib/locales/fr/adjective.yml +266 -0
- data/lib/locales/fr/ancient.yml +141 -0
- data/lib/locales/fr-CA.yml +1 -1
- data/lib/locales/fr-CH.yml +1 -1
- data/lib/locales/hy.yml +2 -1
- data/lib/locales/it.yml +1 -0
- data/lib/locales/ja/address.yml +258 -4169
- data/lib/locales/ja/adjective.yml +148 -0
- data/lib/locales/ja/dog.yml +1 -0
- data/lib/locales/ja/emotion.yml +51 -0
- data/lib/locales/ja/lorem.yml +2 -2
- data/lib/locales/ja/naruto.yml +230 -0
- data/lib/locales/ja/relationship.yml +10 -0
- data/lib/locales/ja/super_mario.yml +1 -1
- data/lib/locales/ja/super_smash_bros.yml +8 -0
- data/lib/locales/ko.yml +1 -0
- data/lib/locales/lt.yml +34 -0
- data/lib/locales/lv.yml +1 -1
- data/lib/locales/mi-NZ.yml +283 -0
- data/lib/locales/nb-NO.yml +1 -0
- data/lib/locales/nl.yml +1 -0
- data/lib/locales/pl.yml +2 -2
- data/lib/locales/pt-BR.yml +5 -0
- data/lib/locales/pt.yml +1 -1
- data/lib/locales/ru.yml +1 -0
- data/lib/locales/sk.yml +1 -0
- data/lib/locales/sv.yml +1 -0
- data/lib/locales/th.yml +76 -76
- data/lib/locales/tr.yml +1 -0
- data/lib/locales/uk.yml +1 -0
- data/lib/locales/vi.yml +1 -0
- data/lib/locales/zh-CN.yml +1 -0
- data/lib/locales/zh-TW.yml +1 -0
- metadata +96 -33
- data/lib/faker/default/fillmurray.rb +0 -45
- data/lib/faker/default/lorem_pixel.rb +0 -70
- /data/lib/faker/default/{faker_adjective.rb → adjective.rb} +0 -0
data/README.md
CHANGED
@@ -3,76 +3,114 @@
|
|
3
3
|
# Faker
|
4
4
|
[![Tests](https://github.com/faker-ruby/faker/workflows/Tests/badge.svg)](https://github.com/faker-ruby/faker/actions?query=workflow%3ATests)
|
5
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=
|
6
|
+
[![Inline docs](https://inch-ci.org/github/faker-ruby/faker.svg?branch=main)](https://inch-ci.org/github/faker-ruby/faker)
|
7
7
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/ef54c7f9df86e965d64b/test_coverage)](https://codeclimate.com/github/stympy/faker/test_coverage)
|
8
8
|
[![Maintainability](https://api.codeclimate.com/v1/badges/ef54c7f9df86e965d64b/maintainability)](https://codeclimate.com/github/stympy/faker/maintainability)
|
9
|
-
[![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=faker&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=faker&package-manager=bundler&version-scheme=semver)
|
10
9
|
|
11
|
-
|
10
|
+
Faker is a port of [Perl's Data::Faker library](https://metacpan.org/pod/Data::Faker).
|
11
|
+
It's a library for generating fake data such as names, addresses, and phone numbers.
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
Faker helps you generate realistic test data, and populate your
|
14
|
+
database with more than a couple of records while you're doing development.
|
15
|
+
|
16
|
+
It comes in very handy for taking screenshots (taking screenshots for a personal project)
|
17
|
+
and it was the original impetus for the creation of this gem).
|
18
|
+
|
19
|
+
## Quick links
|
20
|
+
|
21
|
+
- 📖 **[Read the documentation for the latest version][rubydocs].**
|
22
|
+
- 📢 **[See what's changed in recent versions][changelog].**
|
23
|
+
|
24
|
+
[rubydocs]: https://www.rubydoc.info/gems/faker/
|
25
|
+
[changelog]: CHANGELOG.md
|
26
|
+
|
27
|
+
## Table of Contents
|
18
28
|
|
19
29
|
- [Faker](#faker)
|
20
|
-
|
21
|
-
- [
|
30
|
+
- [Quick links](#quick-links)
|
31
|
+
- [Table of Contents](#table-of-contents)
|
32
|
+
- [Notes](#notes)
|
33
|
+
- [Getting Started](#getting-started)
|
22
34
|
- [Usage](#usage)
|
23
|
-
|
35
|
+
- [A note about the Generators versions](#a-note-about-the-generators-versions)
|
24
36
|
- [Ensuring unique values](#ensuring-unique-values)
|
25
37
|
- [Deterministic Random](#deterministic-random)
|
38
|
+
- [Customization](#customization)
|
39
|
+
- [Minitest and Faker \>= 2.22](#minitest-and-faker--222)
|
26
40
|
- [Generators](#generators)
|
27
|
-
- [Default](#default)
|
28
|
-
- [Blockchain](#blockchain)
|
29
|
-
- [Books](#books)
|
30
|
-
- [Fantasy](#fantasy)
|
31
|
-
- [Creature](#creature)
|
32
|
-
- [Games](#games)
|
33
|
-
- [Japanese Media](#japanese-media)
|
34
|
-
- [Movies](#movies)
|
35
|
-
- [Music](#music)
|
36
|
-
- [Quotes](#quotes)
|
37
|
-
- [Sports](#sports)
|
38
|
-
- [Tv Shows](#tv-shows)
|
39
|
-
- [Customization](#customization)
|
40
41
|
- [Contributing](#contributing)
|
41
|
-
- [
|
42
|
+
- [Versioning](#versioning)
|
42
43
|
- [License](#license)
|
43
44
|
|
44
|
-
###
|
45
|
+
### Notes
|
46
|
+
|
45
47
|
* While Faker generates data at random, returned values are not guaranteed to be unique by default.
|
46
|
-
|
47
|
-
Values also can be deterministic if you use the deterministic feature, see [
|
48
|
-
* This is the `
|
49
|
-
Please refer the README of your version for the available methods.
|
50
|
-
|
51
|
-
|
52
|
-
##
|
53
|
-
|
54
|
-
|
55
|
-
```
|
56
|
-
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:
|
48
|
+
To explicitly specify when you require unique values, see [Ensuring Unique Values](#ensuring-unique-values).
|
49
|
+
Values also can be deterministic if you use the deterministic feature, see [Deterministic Random](#deterministic-random)
|
50
|
+
* This is the `main` branch of Faker and may contain changes that are not yet released.
|
51
|
+
Please refer to the README of your version for the available methods.
|
52
|
+
The list of all versions is [available here](https://github.com/stympy/faker/releases).
|
53
|
+
|
54
|
+
## Getting Started
|
55
|
+
|
56
|
+
Start by including `faker` in your Gemfile:
|
57
57
|
|
58
58
|
```ruby
|
59
|
-
gem 'faker'
|
59
|
+
gem 'faker'
|
60
60
|
```
|
61
61
|
|
62
|
+
Then run `bundle install`.
|
63
|
+
|
62
64
|
## Usage
|
65
|
+
|
66
|
+
Here are some examples of how to use Faker:
|
67
|
+
|
63
68
|
```ruby
|
64
69
|
require 'faker'
|
65
70
|
|
66
71
|
Faker::Name.name #=> "Christophe Bartell"
|
67
72
|
|
68
|
-
Faker::
|
73
|
+
Faker::Address.full_address #=> "5479 William Way, East Sonnyhaven, LA 63637"
|
74
|
+
|
75
|
+
Faker::Markdown.emphasis #=> "Quo qui aperiam. Amet corrupti distinctio. Sit quia *dolor.*"
|
76
|
+
|
77
|
+
Faker::TvShows::RuPaul.queen #=> "Violet Chachki"
|
78
|
+
|
79
|
+
Faker::Alphanumeric.alpha(number: 10) #=> "zlvubkrwga"
|
80
|
+
|
81
|
+
Faker::ProgrammingLanguage.name #=> "Ruby"
|
82
|
+
```
|
83
|
+
|
84
|
+
For a complete list of the generators, see [Generators](#generators).
|
85
|
+
|
86
|
+
#### A note about the Generators versions
|
87
|
+
|
88
|
+
If you get a `uninitialized constant Faker::[some_class]` error, your version of
|
89
|
+
the gem is behind main.
|
90
|
+
|
91
|
+
To make sure that your gem is the one
|
92
|
+
documented here, change the line in your Gemfile to:
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main'
|
69
96
|
```
|
70
97
|
|
71
|
-
|
72
|
-
|
98
|
+
The generators have the `@faker.version` tag on top of their implementation.
|
99
|
+
From the tags, you can identify the version the generator was added:
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
# Faker::TvShows::ParksAndRec.character
|
103
|
+
|
104
|
+
# @faker.version 1.9.0
|
105
|
+
def character
|
106
|
+
fetch('parks_and_rec.characters')
|
107
|
+
end
|
108
|
+
```
|
73
109
|
|
74
110
|
### Ensuring unique values
|
75
|
-
|
111
|
+
|
112
|
+
To ensure Faker generates unique values, prefix your method call with `unique`:
|
113
|
+
|
76
114
|
```ruby
|
77
115
|
Faker::Name.unique.name # This will return a unique name every time it is called
|
78
116
|
```
|
@@ -81,6 +119,7 @@ If too many unique values are requested from a generator that has a limited
|
|
81
119
|
number of potential values, a `Faker::UniqueGenerator::RetryLimitExceeded`
|
82
120
|
exception may be raised. It is possible to clear the record of unique values
|
83
121
|
that have been returned, for example between tests.
|
122
|
+
|
84
123
|
```ruby
|
85
124
|
Faker::Name.unique.clear # Clears used values for Faker::Name
|
86
125
|
Faker::UniqueGenerator.clear # Clears used values for all generators
|
@@ -99,7 +138,9 @@ Faker::Lorem.unique.exclude :string, [number: 6], %w[azerty wxcvbn]
|
|
99
138
|
```
|
100
139
|
|
101
140
|
### Deterministic Random
|
102
|
-
|
141
|
+
|
142
|
+
Faker supports seeding of its pseudo-random number generator (PRNG)
|
143
|
+
to provide deterministic output of repeated method calls.
|
103
144
|
|
104
145
|
```ruby
|
105
146
|
Faker::Config.random = Random.new(42)
|
@@ -114,14 +155,49 @@ Faker::Config.random.seed #=> 185180369676275068918401850258677722187
|
|
114
155
|
Faker::Company.bs #=> "cultivate viral synergies"
|
115
156
|
```
|
116
157
|
|
158
|
+
### Customization
|
159
|
+
|
160
|
+
You may want Faker to print information depending on your location in the world.
|
161
|
+
To assist you in this, Faker uses the `I18n` gem to store strings and formats to
|
162
|
+
represent the names and postal codes of the area of your choosing.
|
163
|
+
|
164
|
+
Just set the locale you want as shown below, and Faker will take care of the rest.
|
165
|
+
|
166
|
+
```ruby
|
167
|
+
Faker::Config.locale = 'es'
|
168
|
+
# or
|
169
|
+
Faker::Config.locale = :es
|
170
|
+
```
|
171
|
+
|
172
|
+
Note: Overriding the default locale might not be thread-safe. See [Locale setting can be ignored #2563](https://github.com/faker-ruby/faker/issues/2563) for more details.
|
173
|
+
|
174
|
+
To override Faker's locales,
|
175
|
+
check out the [locales README](lib/locales/README.md).
|
176
|
+
|
177
|
+
### Minitest and Faker >= 2.22
|
178
|
+
|
179
|
+
To prevent Faker (version >= 2.22) from generating duplicate values when using Minitest,
|
180
|
+
you might need to add the following to the `test_helper.rb` or `rails_helper.rb` file:
|
181
|
+
|
182
|
+
```ruby
|
183
|
+
Faker::Config.random = Random.new
|
184
|
+
```
|
185
|
+
|
186
|
+
See [Issue #2534](https://github.com/faker-ruby/faker/issues/2534) for more details.
|
187
|
+
|
117
188
|
## Generators
|
189
|
+
|
190
|
+
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.
|
191
|
+
|
118
192
|
**NOTE: Some of the generators below aren't released yet. If you want to use them, change the line in your gemfile to:**
|
119
193
|
|
120
194
|
```ruby
|
121
|
-
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => '
|
195
|
+
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main'
|
122
196
|
```
|
123
197
|
|
124
|
-
|
198
|
+
<details>
|
199
|
+
<summary>Default</summary>
|
200
|
+
|
125
201
|
- [Faker::Address](doc/default/address.md)
|
126
202
|
- [Faker::Alphanumeric](doc/default/alphanumeric.md)
|
127
203
|
- [Faker::Ancient](doc/default/ancient.md)
|
@@ -136,6 +212,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
136
212
|
- [Faker::Boolean](doc/default/boolean.md)
|
137
213
|
- [Faker::BossaNova](doc/default/bossa_nova.md)
|
138
214
|
- [Faker::Business](doc/default/business.md)
|
215
|
+
- [Faker::Camera](doc/default/camera.md)
|
139
216
|
- [Faker::Cannabis](doc/default/cannabis.md)
|
140
217
|
- [Faker::ChileRut](doc/default/chile_rut.md)
|
141
218
|
- [Faker::ChuckNorris](doc/default/chuck_norris.md)
|
@@ -164,7 +241,6 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
164
241
|
- [Faker::Emotion](doc/default/emotion.md)
|
165
242
|
- [Faker::Esport](doc/default/esport.md)
|
166
243
|
- [Faker::File](doc/default/file.md)
|
167
|
-
- [Faker::Fillmurray](doc/default/fillmurray.md)
|
168
244
|
- [Faker::Finance](doc/default/finance.md)
|
169
245
|
- [Faker::Food](doc/default/food.md)
|
170
246
|
- [Faker::FunnyName](doc/default/funny_name.md)
|
@@ -183,7 +259,6 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
183
259
|
- [Faker::Kpop](doc/default/kpop.md)
|
184
260
|
- [Faker::Lorem](doc/default/lorem.md)
|
185
261
|
- [Faker::LoremFlickr](doc/default/lorem_flickr.md)
|
186
|
-
- [Faker::LoremPixel](doc/default/lorem_pixel.md)
|
187
262
|
- [Faker::Markdown](doc/default/markdown.md)
|
188
263
|
- [Faker::Marketing](doc/default/marketing.md)
|
189
264
|
- [Faker::Measurement](doc/default/measurement.md)
|
@@ -217,31 +292,54 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
217
292
|
- [Faker::University](doc/default/university.md)
|
218
293
|
- [Faker::Vehicle](doc/default/vehicle.md)
|
219
294
|
- [Faker::Verbs](doc/default/verbs.md)
|
295
|
+
- [Faker::VulnerabilityIdentifier](doc/default/vulnerability_identifier.md)
|
220
296
|
- [Faker::WorldCup](doc/default/world_cup.md)
|
297
|
+
</details>
|
298
|
+
|
299
|
+
<details>
|
300
|
+
<summary>Blockchain</summary>
|
221
301
|
|
222
|
-
### Blockchain
|
223
302
|
- [Faker::Blockchain::Aeternity](doc/blockchain/aeternity.md)
|
224
303
|
- [Faker::Blockchain::Bitcoin](doc/blockchain/bitcoin.md)
|
225
304
|
- [Faker::Blockchain::Ethereum](doc/blockchain/ethereum.md)
|
226
305
|
- [Faker::Blockchain::Tezos](doc/blockchain/tezos.md)
|
306
|
+
</details>
|
307
|
+
|
308
|
+
<details>
|
309
|
+
<summary>Books</summary>
|
227
310
|
|
228
|
-
### Books
|
229
311
|
- [Faker::Book](doc/books/book.md)
|
230
312
|
- [Faker::Books::CultureSeries](doc/books/culture_series.md)
|
231
313
|
- [Faker::Books::Dune](doc/books/dune.md)
|
232
314
|
- [Faker::Books::Lovecraft](doc/books/lovecraft.md)
|
315
|
+
- [Faker::Books::TheKingkillerChronicle](doc/books/the_kingkiller_chronicle.md)
|
316
|
+
</details>
|
317
|
+
|
318
|
+
<details>
|
319
|
+
<summary>Fantasy</summary>
|
233
320
|
|
234
|
-
### Fantasy
|
235
321
|
- [Faker::Fantasy::Tolkien](doc/fantasy/tolkien.md)
|
322
|
+
</details>
|
323
|
+
|
324
|
+
<details>
|
325
|
+
<summary>Travel</summary>
|
326
|
+
|
327
|
+
- [Faker:Travel::Airport](doc/travel/airport.md)
|
328
|
+
</details>
|
329
|
+
|
330
|
+
<details>
|
331
|
+
<summary>Creature</summary>
|
236
332
|
|
237
|
-
### Creature
|
238
333
|
- [Faker::Creature::Animal](doc/creature/animal.md)
|
239
334
|
- [Faker::Creature::Bird](doc/creature/bird.md)
|
240
335
|
- [Faker::Creature::Cat](doc/creature/cat.md)
|
241
336
|
- [Faker::Creature::Dog](doc/creature/dog.md)
|
242
337
|
- [Faker::Creature::Horse](doc/creature/horse.md)
|
338
|
+
</details>
|
339
|
+
|
340
|
+
<details>
|
341
|
+
<summary>Games</summary>
|
243
342
|
|
244
|
-
### Games
|
245
343
|
- [Faker::Game](doc/games/game.md)
|
246
344
|
- [Faker::Games::ClashOfClans](doc/games/clash_of_clans.md)
|
247
345
|
- [Faker::Games::DnD](doc/games/dnd.md)
|
@@ -265,8 +363,12 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
265
363
|
- [Faker::Games::Witcher](doc/games/witcher.md)
|
266
364
|
- [Faker::Games::WorldOfWarcraft](doc/games/world_of_warcraft.md)
|
267
365
|
- [Faker::Games::Zelda](doc/games/zelda.md)
|
366
|
+
</details>
|
268
367
|
|
269
|
-
|
368
|
+
<details>
|
369
|
+
<summary>Japanese Media</summary>
|
370
|
+
|
371
|
+
- [Faker::JapaneseMedia::CowboyBebop](doc/japanese_media/cowboy_bebop.md)
|
270
372
|
- [Faker::JapaneseMedia::DragonBall](doc/japanese_media/dragon_ball.md)
|
271
373
|
- [Faker::JapaneseMedia::OnePiece](doc/japanese_media/one_piece.md)
|
272
374
|
- [Faker::JapaneseMedia::StudioGhibli](doc/japanese_media/studio_ghibli.md)
|
@@ -274,9 +376,14 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
274
376
|
- [Faker::JapaneseMedia::Naruto](doc/japanese_media/naruto.md)
|
275
377
|
- [Faker::JapaneseMedia::Doraemon](doc/japanese_media/doraemon.md)
|
276
378
|
- [Faker::JapaneseMedia::Conan](doc/japanese_media/conan.md)
|
379
|
+
- [Faker::JapaneseMedia::FmaBrotherhood](doc/japanese_media/fullmetal_alchemist_brotherhood.md)
|
380
|
+
</details>
|
381
|
+
|
382
|
+
<details>
|
383
|
+
<summary>Movies</summary>
|
277
384
|
|
278
|
-
### Movies
|
279
385
|
- [Faker::Movie](doc/movies/movie.md)
|
386
|
+
- [Faker::Movies::Avatar](doc/movies/avatar.md)
|
280
387
|
- [Faker::Movies::BackToTheFuture](doc/movies/back_to_the_future.md)
|
281
388
|
- [Faker::Movies::Departed](doc/movies/departed.md)
|
282
389
|
- [Faker::Movies::Ghostbusters](doc/movies/ghostbusters.md)
|
@@ -288,9 +395,13 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
288
395
|
- [Faker::Movies::LordOfTheRings](doc/movies/lord_of_the_rings.md)
|
289
396
|
- [Faker::Movies::PrincessBride](doc/movies/princess_bride.md)
|
290
397
|
- [Faker::Movies::StarWars](doc/movies/star_wars.md)
|
398
|
+
- [Faker::Movies::TRON](doc/movies/tron.md)
|
291
399
|
- [Faker::Movies::VForVendetta](doc/movies/v_for_vendetta.md)
|
400
|
+
</details>
|
401
|
+
|
402
|
+
<details>
|
403
|
+
<summary>Music</summary>
|
292
404
|
|
293
|
-
### Music
|
294
405
|
- [Faker::Music](doc/music/music.md)
|
295
406
|
- [Faker::Music::GratefulDead](doc/music/grateful_dead.md)
|
296
407
|
- [Faker::Music::Hiphop](doc/music/hiphop.md)
|
@@ -301,23 +412,36 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
301
412
|
- [Faker::Music::RockBand](doc/music/rock_band.md)
|
302
413
|
- [Faker::Music::Rush](doc/music/rush.md)
|
303
414
|
- [Faker::Music::UmphreysMcgee](doc/music/umphreys_mcgee.md)
|
415
|
+
</details>
|
416
|
+
|
417
|
+
<details>
|
418
|
+
<summary>Quotes</summary>
|
304
419
|
|
305
|
-
### Quotes
|
306
420
|
- [Faker::Quote](doc/quotes/quote.md)
|
307
421
|
- [Faker::Quotes::Chiquito](doc/quotes/chiquito.md)
|
308
422
|
- [Faker::Quotes::Rajnikanth](doc/quotes/rajnikanth.md)
|
309
423
|
- [Faker::Quotes::Shakespeare](doc/quotes/shakespeare.md)
|
424
|
+
</details>
|
310
425
|
|
426
|
+
<details>
|
427
|
+
<summary>Sports</summary>
|
311
428
|
|
312
|
-
|
429
|
+
- [Faker::Sports](doc/sports/sports.md)
|
313
430
|
- [Faker::Sports::Basketball](doc/sports/basketball.md)
|
431
|
+
- [Faker::Sports::Chess](doc/sports/chess.md)
|
314
432
|
- [Faker::Sports::Football](doc/sports/football.md)
|
433
|
+
- [Faker::Sports::Mountaineering](doc/sports/mountaineering.md)
|
434
|
+
- [Faker::Sports::Volleyball](doc/sports/volleyball.md)
|
435
|
+
</details>
|
436
|
+
|
437
|
+
<details>
|
438
|
+
<summary>Tv Shows</summary>
|
315
439
|
|
316
|
-
### Tv Shows
|
317
440
|
- [Faker::TvShows::AquaTeenHungerForce](doc/tv_shows/aqua_teen_hunger_force.md)
|
318
441
|
- [Faker::TvShows::BigBangTheory](doc/tv_shows/big_bang_theory.md)
|
319
442
|
- [Faker::TvShows::BojackHorseman](doc/tv_shows/bojack_horseman.md)
|
320
443
|
- [Faker::TvShows::BreakingBad](doc/tv_shows/breaking_bad.md)
|
444
|
+
- [Faker::TvShows::BrooklynNineNine](doc/tv_shows/brooklyn_nine_nine.md)
|
321
445
|
- [Faker::TvShows::Buffy](doc/tv_shows/buffy.md)
|
322
446
|
- [Faker::TvShows::Community](doc/tv_shows/community.md)
|
323
447
|
- [Faker::TvShows::DrWho](doc/tv_shows/dr_who.md)
|
@@ -337,6 +461,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
337
461
|
- [Faker::TvShows::SiliconValley](doc/tv_shows/silicon_valley.md)
|
338
462
|
- [Faker::TvShows::Simpsons](doc/tv_shows/simpsons.md)
|
339
463
|
- [Faker::TvShows::SouthPark](doc/tv_shows/south_park.md)
|
464
|
+
- [Faker::TvShows::Spongebob](doc/tv_shows/spongebob.md)
|
340
465
|
- [Faker::TvShows::StarTrek](doc/tv_shows/star_trek.md)
|
341
466
|
- [Faker::TvShows::Stargate](doc/tv_shows/stargate.md)
|
342
467
|
- [Faker::TvShows::StrangerThings](doc/tv_shows/stranger_things.md)
|
@@ -348,56 +473,25 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
348
473
|
- [Faker::TvShows::TheThickOfIt](doc/tv_shows/the_thick_of_it.md)
|
349
474
|
- [Faker::TvShows::TwinPeaks](doc/tv_shows/twin_peaks.md)
|
350
475
|
- [Faker::TvShows::VentureBros](doc/tv_shows/venture_bros.md)
|
351
|
-
|
352
|
-
## Customization
|
353
|
-
Since you may want to make addresses and other types of data look different
|
354
|
-
depending on where in the world you are (US postal codes vs. UK postal codes,
|
355
|
-
for example), Faker uses the I18n gem to store strings (like state names) and
|
356
|
-
formats (US postal codes are NNNNN while UK postal codes are AAN NAA),
|
357
|
-
allowing you to get different formats by switching locales. Just set
|
358
|
-
Faker::Config.locale to the locale you want, and Faker will take care of the
|
359
|
-
rest.
|
360
|
-
|
361
|
-
If your locale doesn't already exist, create it in the `lib/locales` directory
|
362
|
-
and you can then override or add elements to suit your needs. See more about how to
|
363
|
-
use locales [here](lib/locales/README.md)
|
364
|
-
|
365
|
-
```yaml
|
366
|
-
en-au-ocker:
|
367
|
-
faker:
|
368
|
-
name:
|
369
|
-
# Existing faker field, new data
|
370
|
-
first_name:
|
371
|
-
- Charlotte
|
372
|
-
- Ava
|
373
|
-
- Chloe
|
374
|
-
- Emily
|
375
|
-
|
376
|
-
# New faker fields
|
377
|
-
ocker_first_name:
|
378
|
-
- Bazza
|
379
|
-
- Bluey
|
380
|
-
- Davo
|
381
|
-
- Johno
|
382
|
-
- Shano
|
383
|
-
- Shazza
|
384
|
-
region:
|
385
|
-
- South East Queensland
|
386
|
-
- Wide Bay Burnett
|
387
|
-
- Margaret River
|
388
|
-
- Port Pirie
|
389
|
-
- Gippsland
|
390
|
-
- Elizabeth
|
391
|
-
- Barossa
|
392
|
-
```
|
476
|
+
</details>
|
393
477
|
|
394
478
|
## Contributing
|
395
|
-
See [CONTRIBUTING.md](https://github.com/stympy/faker/blob/master/CONTRIBUTING.md).
|
396
479
|
|
397
|
-
|
398
|
-
|
480
|
+
If you have problems, please create a [GitHub Issue](/.github/ISSUE_TEMPLATE/bug-report.md).
|
481
|
+
|
482
|
+
Take a look at the [Contributing](CONTRIBUTING.md) document for
|
483
|
+
instructions on setting up the repo on your machine, understanding the codebase,
|
484
|
+
and creating a good pull request.
|
399
485
|
|
400
|
-
|
486
|
+
There is a [Discord channel](https://discord.gg/RMumTwB) to discuss anything
|
487
|
+
regarding improvements or feature requests.
|
488
|
+
|
489
|
+
Thank you, contributors!
|
490
|
+
|
491
|
+
## Versioning
|
492
|
+
|
493
|
+
Faker follows Semantic Versioning 2.0 as defined at https://semver.org.
|
401
494
|
|
402
495
|
## License
|
496
|
+
|
403
497
|
This code is free to use under the terms of the MIT license.
|
@@ -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
|