faker 2.20.0 → 3.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +346 -7
- data/History.md +1 -1
- data/README.md +193 -107
- 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 +25 -25
- data/lib/faker/default/code.rb +68 -39
- data/lib/faker/default/color.rb +77 -6
- data/lib/faker/default/commerce.rb +3 -17
- data/lib/faker/default/company.rb +50 -19
- data/lib/faker/default/crypto_coin.rb +3 -15
- data/lib/faker/default/date.rb +65 -42
- data/lib/faker/default/demographic.rb +1 -5
- data/lib/faker/default/driving_licence.rb +20 -19
- 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/html.rb +230 -0
- data/lib/faker/default/id_number.rb +125 -14
- data/lib/faker/default/internet.rb +116 -111
- data/lib/faker/default/invoice.rb +4 -17
- data/lib/faker/default/json.rb +2 -20
- data/lib/faker/default/lorem.rb +25 -74
- 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/nhs.rb +2 -6
- data/lib/faker/default/number.rb +10 -55
- data/lib/faker/default/omniauth.rb +6 -40
- 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/release notes.md +59 -0
- 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 +7 -23
- data/lib/faker/default/types.rb +7 -28
- data/lib/faker/default/vehicle.rb +40 -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/final_fantasy_xiv.rb +73 -0
- 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/kamen_rider.rb +2 -2
- 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/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/travel/train_station.rb +54 -0
- data/lib/faker/tv_shows/archer.rb +51 -0
- data/lib/faker/tv_shows/south_park.rb +15 -0
- data/lib/faker/tv_shows/spongebob.rb +50 -0
- data/lib/faker/version.rb +1 -1
- data/lib/faker.rb +26 -67
- data/lib/helpers/base58.rb +1 -1
- data/lib/helpers/positional_generator.rb +480 -0
- data/lib/helpers/unique_generator.rb +13 -11
- data/lib/locales/README.md +18 -2
- data/lib/locales/ar.yml +1 -0
- data/lib/locales/bg.yml +1 -1
- data/lib/locales/da-DK.yml +1 -1
- data/lib/locales/de-AT.yml +1 -2
- data/lib/locales/de-CH.yml +4336 -12
- data/lib/locales/de.yml +1 -1
- data/lib/locales/en/airport.yml +381 -0
- data/lib/locales/en/archer.yml +75 -0
- data/lib/locales/en/australia.yml +3 -4
- data/lib/locales/en/avatar.yml +31 -0
- data/lib/locales/en/chess.yml +103 -0
- 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/final_fantasy_xiv.yml +754 -0
- data/lib/locales/en/finance.yml +3 -1
- data/lib/locales/en/food.yml +12 -0
- data/lib/locales/en/game.yml +0 -1
- data/lib/locales/en/hackers.yml +53 -0
- data/lib/locales/en/heroes.yml +2 -2
- data/lib/locales/en/internet.yml +32 -0
- data/lib/locales/en/minecraft.yml +4 -4
- data/lib/locales/en/mitch_hedberg.yml +46 -0
- 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 +2 -2
- data/lib/locales/en/overwatch.yml +5 -7
- data/lib/locales/en/source.yml +5 -0
- data/lib/locales/en/south_park.yml +360 -2
- 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/tarkov.yml +593 -0
- data/lib/locales/en/train_station.yml +280 -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 +1 -1
- 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/name.yml +2 -1
- 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/adjective.yml +148 -0
- data/lib/locales/ja/dog.yml +1 -0
- data/lib/locales/ja/emotion.yml +51 -0
- data/lib/locales/ja/naruto.yml +230 -0
- data/lib/locales/ja/relationship.yml +10 -0
- data/lib/locales/ja/sport.yml +130 -0
- data/lib/locales/ja/super_mario.yml +1 -1
- data/lib/locales/ko.yml +1 -0
- data/lib/locales/lt.yml +0 -1
- data/lib/locales/mi-NZ.yml +2 -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 +1 -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 +3 -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 +46 -127
- 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
|
[](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
|
-
[](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"
|
|
69
82
|
```
|
|
70
83
|
|
|
71
|
-
|
|
72
|
-
|
|
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'
|
|
96
|
+
```
|
|
97
|
+
|
|
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,47 @@ 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
|
+
To override Faker's locales, and set it on threaded server environments
|
|
173
|
+
check out the [locales README](lib/locales/README.md).
|
|
174
|
+
|
|
175
|
+
### Minitest and Faker >= 2.22
|
|
176
|
+
|
|
177
|
+
To prevent Faker (version >= 2.22) from generating duplicate values when using Minitest,
|
|
178
|
+
you might need to add the following to the `test_helper.rb` or `rails_helper.rb` file:
|
|
179
|
+
|
|
180
|
+
```ruby
|
|
181
|
+
Faker::Config.random = Random.new
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
See [Issue #2534](https://github.com/faker-ruby/faker/issues/2534) for more details.
|
|
185
|
+
|
|
117
186
|
## Generators
|
|
187
|
+
|
|
188
|
+
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.
|
|
189
|
+
|
|
118
190
|
**NOTE: Some of the generators below aren't released yet. If you want to use them, change the line in your gemfile to:**
|
|
119
191
|
|
|
120
192
|
```ruby
|
|
121
|
-
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => '
|
|
193
|
+
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main'
|
|
122
194
|
```
|
|
123
195
|
|
|
124
|
-
|
|
196
|
+
<details>
|
|
197
|
+
<summary>Default</summary>
|
|
198
|
+
|
|
125
199
|
- [Faker::Address](doc/default/address.md)
|
|
126
200
|
- [Faker::Alphanumeric](doc/default/alphanumeric.md)
|
|
127
201
|
- [Faker::Ancient](doc/default/ancient.md)
|
|
@@ -165,7 +239,6 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
|
165
239
|
- [Faker::Emotion](doc/default/emotion.md)
|
|
166
240
|
- [Faker::Esport](doc/default/esport.md)
|
|
167
241
|
- [Faker::File](doc/default/file.md)
|
|
168
|
-
- [Faker::Fillmurray](doc/default/fillmurray.md)
|
|
169
242
|
- [Faker::Finance](doc/default/finance.md)
|
|
170
243
|
- [Faker::Food](doc/default/food.md)
|
|
171
244
|
- [Faker::FunnyName](doc/default/funny_name.md)
|
|
@@ -184,7 +257,6 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
|
184
257
|
- [Faker::Kpop](doc/default/kpop.md)
|
|
185
258
|
- [Faker::Lorem](doc/default/lorem.md)
|
|
186
259
|
- [Faker::LoremFlickr](doc/default/lorem_flickr.md)
|
|
187
|
-
- [Faker::LoremPixel](doc/default/lorem_pixel.md)
|
|
188
260
|
- [Faker::Markdown](doc/default/markdown.md)
|
|
189
261
|
- [Faker::Marketing](doc/default/marketing.md)
|
|
190
262
|
- [Faker::Measurement](doc/default/measurement.md)
|
|
@@ -218,38 +290,62 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
|
218
290
|
- [Faker::University](doc/default/university.md)
|
|
219
291
|
- [Faker::Vehicle](doc/default/vehicle.md)
|
|
220
292
|
- [Faker::Verbs](doc/default/verbs.md)
|
|
293
|
+
- [Faker::VulnerabilityIdentifier](doc/default/vulnerability_identifier.md)
|
|
221
294
|
- [Faker::WorldCup](doc/default/world_cup.md)
|
|
295
|
+
</details>
|
|
296
|
+
|
|
297
|
+
<details>
|
|
298
|
+
<summary>Blockchain</summary>
|
|
222
299
|
|
|
223
|
-
### Blockchain
|
|
224
300
|
- [Faker::Blockchain::Aeternity](doc/blockchain/aeternity.md)
|
|
225
301
|
- [Faker::Blockchain::Bitcoin](doc/blockchain/bitcoin.md)
|
|
226
302
|
- [Faker::Blockchain::Ethereum](doc/blockchain/ethereum.md)
|
|
227
303
|
- [Faker::Blockchain::Tezos](doc/blockchain/tezos.md)
|
|
304
|
+
</details>
|
|
305
|
+
|
|
306
|
+
<details>
|
|
307
|
+
<summary>Books</summary>
|
|
228
308
|
|
|
229
|
-
### Books
|
|
230
309
|
- [Faker::Book](doc/books/book.md)
|
|
231
310
|
- [Faker::Books::CultureSeries](doc/books/culture_series.md)
|
|
232
311
|
- [Faker::Books::Dune](doc/books/dune.md)
|
|
233
312
|
- [Faker::Books::Lovecraft](doc/books/lovecraft.md)
|
|
234
313
|
- [Faker::Books::TheKingkillerChronicle](doc/books/the_kingkiller_chronicle.md)
|
|
314
|
+
</details>
|
|
315
|
+
|
|
316
|
+
<details>
|
|
317
|
+
<summary>Fantasy</summary>
|
|
235
318
|
|
|
236
|
-
### Fantasy
|
|
237
319
|
- [Faker::Fantasy::Tolkien](doc/fantasy/tolkien.md)
|
|
320
|
+
</details>
|
|
321
|
+
|
|
322
|
+
<details>
|
|
323
|
+
<summary>Travel</summary>
|
|
324
|
+
|
|
325
|
+
- [Faker:Travel::Airport](doc/travel/airport.md)
|
|
326
|
+
- [Faker:Travel::TrainStation](doc/travel/train_station.md)
|
|
327
|
+
</details>
|
|
328
|
+
|
|
329
|
+
<details>
|
|
330
|
+
<summary>Creature</summary>
|
|
238
331
|
|
|
239
|
-
### Creature
|
|
240
332
|
- [Faker::Creature::Animal](doc/creature/animal.md)
|
|
241
333
|
- [Faker::Creature::Bird](doc/creature/bird.md)
|
|
242
334
|
- [Faker::Creature::Cat](doc/creature/cat.md)
|
|
243
335
|
- [Faker::Creature::Dog](doc/creature/dog.md)
|
|
244
336
|
- [Faker::Creature::Horse](doc/creature/horse.md)
|
|
337
|
+
</details>
|
|
338
|
+
|
|
339
|
+
<details>
|
|
340
|
+
<summary>Games</summary>
|
|
245
341
|
|
|
246
|
-
### Games
|
|
247
342
|
- [Faker::Game](doc/games/game.md)
|
|
248
343
|
- [Faker::Games::ClashOfClans](doc/games/clash_of_clans.md)
|
|
249
344
|
- [Faker::Games::DnD](doc/games/dnd.md)
|
|
250
345
|
- [Faker::Games::Dota](doc/games/dota.md)
|
|
251
346
|
- [Faker::Games::ElderScrolls](doc/games/elder_scrolls.md)
|
|
252
347
|
- [Faker::Games::Fallout](doc/games/fallout.md)
|
|
348
|
+
- [Faker::Games::FinalFantasyXIV](doc/games/final_fantasy_xiv.md)
|
|
253
349
|
- [Faker::Games::HalfLife](doc/games/half_life.md)
|
|
254
350
|
- [Faker::Games::Heroes](doc/games/heroes.md)
|
|
255
351
|
- [Faker::Games::HeroesOfTheStorm](doc/games/heroes_of_the_storm.md)
|
|
@@ -267,8 +363,12 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
|
267
363
|
- [Faker::Games::Witcher](doc/games/witcher.md)
|
|
268
364
|
- [Faker::Games::WorldOfWarcraft](doc/games/world_of_warcraft.md)
|
|
269
365
|
- [Faker::Games::Zelda](doc/games/zelda.md)
|
|
366
|
+
</details>
|
|
367
|
+
|
|
368
|
+
<details>
|
|
369
|
+
<summary>Japanese Media</summary>
|
|
270
370
|
|
|
271
|
-
|
|
371
|
+
- [Faker::JapaneseMedia::CowboyBebop](doc/japanese_media/cowboy_bebop.md)
|
|
272
372
|
- [Faker::JapaneseMedia::DragonBall](doc/japanese_media/dragon_ball.md)
|
|
273
373
|
- [Faker::JapaneseMedia::OnePiece](doc/japanese_media/one_piece.md)
|
|
274
374
|
- [Faker::JapaneseMedia::StudioGhibli](doc/japanese_media/studio_ghibli.md)
|
|
@@ -277,9 +377,13 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
|
277
377
|
- [Faker::JapaneseMedia::Doraemon](doc/japanese_media/doraemon.md)
|
|
278
378
|
- [Faker::JapaneseMedia::Conan](doc/japanese_media/conan.md)
|
|
279
379
|
- [Faker::JapaneseMedia::FmaBrotherhood](doc/japanese_media/fullmetal_alchemist_brotherhood.md)
|
|
380
|
+
</details>
|
|
381
|
+
|
|
382
|
+
<details>
|
|
383
|
+
<summary>Movies</summary>
|
|
280
384
|
|
|
281
|
-
### Movies
|
|
282
385
|
- [Faker::Movie](doc/movies/movie.md)
|
|
386
|
+
- [Faker::Movies::Avatar](doc/movies/avatar.md)
|
|
283
387
|
- [Faker::Movies::BackToTheFuture](doc/movies/back_to_the_future.md)
|
|
284
388
|
- [Faker::Movies::Departed](doc/movies/departed.md)
|
|
285
389
|
- [Faker::Movies::Ghostbusters](doc/movies/ghostbusters.md)
|
|
@@ -291,9 +395,13 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
|
291
395
|
- [Faker::Movies::LordOfTheRings](doc/movies/lord_of_the_rings.md)
|
|
292
396
|
- [Faker::Movies::PrincessBride](doc/movies/princess_bride.md)
|
|
293
397
|
- [Faker::Movies::StarWars](doc/movies/star_wars.md)
|
|
398
|
+
- [Faker::Movies::TRON](doc/movies/tron.md)
|
|
294
399
|
- [Faker::Movies::VForVendetta](doc/movies/v_for_vendetta.md)
|
|
400
|
+
</details>
|
|
401
|
+
|
|
402
|
+
<details>
|
|
403
|
+
<summary>Music</summary>
|
|
295
404
|
|
|
296
|
-
### Music
|
|
297
405
|
- [Faker::Music](doc/music/music.md)
|
|
298
406
|
- [Faker::Music::GratefulDead](doc/music/grateful_dead.md)
|
|
299
407
|
- [Faker::Music::Hiphop](doc/music/hiphop.md)
|
|
@@ -304,20 +412,33 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
|
304
412
|
- [Faker::Music::RockBand](doc/music/rock_band.md)
|
|
305
413
|
- [Faker::Music::Rush](doc/music/rush.md)
|
|
306
414
|
- [Faker::Music::UmphreysMcgee](doc/music/umphreys_mcgee.md)
|
|
415
|
+
</details>
|
|
416
|
+
|
|
417
|
+
<details>
|
|
418
|
+
<summary>Quotes</summary>
|
|
307
419
|
|
|
308
|
-
### Quotes
|
|
309
420
|
- [Faker::Quote](doc/quotes/quote.md)
|
|
310
421
|
- [Faker::Quotes::Chiquito](doc/quotes/chiquito.md)
|
|
311
422
|
- [Faker::Quotes::Rajnikanth](doc/quotes/rajnikanth.md)
|
|
312
423
|
- [Faker::Quotes::Shakespeare](doc/quotes/shakespeare.md)
|
|
424
|
+
</details>
|
|
313
425
|
|
|
426
|
+
<details>
|
|
427
|
+
<summary>Sports</summary>
|
|
314
428
|
|
|
315
|
-
|
|
429
|
+
- [Faker::Sports](doc/sports/sports.md)
|
|
316
430
|
- [Faker::Sports::Basketball](doc/sports/basketball.md)
|
|
431
|
+
- [Faker::Sports::Chess](doc/sports/chess.md)
|
|
317
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>
|
|
318
439
|
|
|
319
|
-
### Tv Shows
|
|
320
440
|
- [Faker::TvShows::AquaTeenHungerForce](doc/tv_shows/aqua_teen_hunger_force.md)
|
|
441
|
+
- [Faker::TvShows::Archer](doc/tv_shows/archer.md)
|
|
321
442
|
- [Faker::TvShows::BigBangTheory](doc/tv_shows/big_bang_theory.md)
|
|
322
443
|
- [Faker::TvShows::BojackHorseman](doc/tv_shows/bojack_horseman.md)
|
|
323
444
|
- [Faker::TvShows::BreakingBad](doc/tv_shows/breaking_bad.md)
|
|
@@ -341,6 +462,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
|
341
462
|
- [Faker::TvShows::SiliconValley](doc/tv_shows/silicon_valley.md)
|
|
342
463
|
- [Faker::TvShows::Simpsons](doc/tv_shows/simpsons.md)
|
|
343
464
|
- [Faker::TvShows::SouthPark](doc/tv_shows/south_park.md)
|
|
465
|
+
- [Faker::TvShows::Spongebob](doc/tv_shows/spongebob.md)
|
|
344
466
|
- [Faker::TvShows::StarTrek](doc/tv_shows/star_trek.md)
|
|
345
467
|
- [Faker::TvShows::Stargate](doc/tv_shows/stargate.md)
|
|
346
468
|
- [Faker::TvShows::StrangerThings](doc/tv_shows/stranger_things.md)
|
|
@@ -352,61 +474,25 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
|
352
474
|
- [Faker::TvShows::TheThickOfIt](doc/tv_shows/the_thick_of_it.md)
|
|
353
475
|
- [Faker::TvShows::TwinPeaks](doc/tv_shows/twin_peaks.md)
|
|
354
476
|
- [Faker::TvShows::VentureBros](doc/tv_shows/venture_bros.md)
|
|
477
|
+
</details>
|
|
355
478
|
|
|
356
|
-
##
|
|
357
|
-
Since you may want to make addresses and other types of data look different
|
|
358
|
-
depending on where in the world you are (US postal codes vs. UK postal codes,
|
|
359
|
-
for example), Faker uses the I18n gem to store strings (like state names) and
|
|
360
|
-
formats (US postal codes are NNNNN while UK postal codes are AAN NAA),
|
|
361
|
-
allowing you to get different formats by switching locales.
|
|
362
|
-
Just set the locale you want as shown below, and Faker will take care of the rest.
|
|
479
|
+
## Contributing
|
|
363
480
|
|
|
364
|
-
|
|
365
|
-
Faker::Config.locale = 'es'
|
|
366
|
-
# or
|
|
367
|
-
Faker::Config.locale = :es
|
|
368
|
-
```
|
|
481
|
+
If you have problems, please create a [GitHub Issue](/.github/ISSUE_TEMPLATE/bug-report.md).
|
|
369
482
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
```yaml
|
|
375
|
-
en-au-ocker:
|
|
376
|
-
faker:
|
|
377
|
-
name:
|
|
378
|
-
# Existing faker field, new data
|
|
379
|
-
first_name:
|
|
380
|
-
- Charlotte
|
|
381
|
-
- Ava
|
|
382
|
-
- Chloe
|
|
383
|
-
- Emily
|
|
384
|
-
|
|
385
|
-
# New faker fields
|
|
386
|
-
ocker_first_name:
|
|
387
|
-
- Bazza
|
|
388
|
-
- Bluey
|
|
389
|
-
- Davo
|
|
390
|
-
- Johno
|
|
391
|
-
- Shano
|
|
392
|
-
- Shazza
|
|
393
|
-
region:
|
|
394
|
-
- South East Queensland
|
|
395
|
-
- Wide Bay Burnett
|
|
396
|
-
- Margaret River
|
|
397
|
-
- Port Pirie
|
|
398
|
-
- Gippsland
|
|
399
|
-
- Elizabeth
|
|
400
|
-
- Barossa
|
|
401
|
-
```
|
|
483
|
+
Take a look at the [Contributing](CONTRIBUTING.md) document for
|
|
484
|
+
instructions on setting up the repo on your machine, understanding the codebase,
|
|
485
|
+
and creating a good pull request.
|
|
402
486
|
|
|
403
|
-
|
|
404
|
-
|
|
487
|
+
There is a [Discord channel](https://discord.gg/RMumTwB) to discuss anything
|
|
488
|
+
regarding improvements or feature requests.
|
|
405
489
|
|
|
406
|
-
|
|
407
|
-
Comments and feedback are welcome. Send an email to Benjamin Curtis via the [google group](http://groups.google.com/group/ruby-faker).
|
|
490
|
+
Thank you, contributors!
|
|
408
491
|
|
|
409
|
-
|
|
492
|
+
## Versioning
|
|
493
|
+
|
|
494
|
+
Faker follows Semantic Versioning 2.0 as defined at https://semver.org.
|
|
410
495
|
|
|
411
496
|
## License
|
|
497
|
+
|
|
412
498
|
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
|