faker 3.0.0 → 3.5.2
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 +598 -1
- data/README.md +203 -107
- data/lib/faker/books/lovecraft.rb +2 -3
- data/lib/faker/default/address.rb +2 -2
- data/lib/faker/default/alphanumeric.rb +1 -1
- data/lib/faker/default/chile_rut.rb +23 -17
- data/lib/faker/default/code.rb +65 -19
- data/lib/faker/default/company.rb +112 -5
- data/lib/faker/default/crypto.rb +13 -4
- data/lib/faker/default/date.rb +61 -5
- data/lib/faker/default/driving_licence.rb +19 -8
- data/lib/faker/default/drone.rb +1 -1
- data/lib/faker/default/finance.rb +2 -2
- data/lib/faker/default/food.rb +14 -1
- data/lib/faker/default/hipster.rb +2 -3
- data/lib/faker/default/html.rb +230 -0
- data/lib/faker/default/id_number.rb +38 -24
- data/lib/faker/default/internet.rb +85 -78
- data/lib/faker/default/invoice.rb +4 -4
- data/lib/faker/default/json.rb +9 -4
- data/lib/faker/default/lorem.rb +24 -16
- data/lib/faker/default/marketing.rb +1 -1
- data/lib/faker/default/measurement.rb +8 -8
- data/lib/faker/default/{nhs.rb → national_health_service.rb} +8 -4
- data/lib/faker/default/number.rb +1 -1
- data/lib/faker/default/omniauth.rb +5 -5
- data/lib/faker/default/phone_number.rb +37 -18
- data/lib/faker/default/placeholdit.rb +1 -1
- data/lib/faker/default/south_africa.rb +3 -3
- data/lib/faker/{music/show.rb → default/theater.rb} +8 -8
- data/lib/faker/default/twitter.rb +4 -6
- data/lib/faker/default/types.rb +5 -6
- data/lib/faker/default/vehicle.rb +26 -36
- data/lib/faker/games/clash_of_clans.rb +1 -1
- data/lib/faker/games/dnd.rb +49 -7
- data/lib/faker/games/final_fantasy_xiv.rb +73 -0
- data/lib/faker/games/heroes_of_the_storm.rb +0 -11
- data/lib/faker/games/minecraft.rb +1 -1
- data/lib/faker/games/myst.rb +1 -1
- data/lib/faker/japanese_media/cowboy_bebop.rb +61 -0
- data/lib/faker/japanese_media/fullmetal_alchemist_brotherhood.rb +10 -10
- data/lib/faker/locations/australia.rb +40 -38
- data/lib/faker/movies/avatar.rb +49 -0
- data/lib/faker/movies/star_wars.rb +1 -1
- data/lib/faker/movies/{room.rb → the_room.rb} +4 -4
- data/lib/faker/music/smashing_pumpkins.rb +64 -0
- data/lib/faker/quotes/quote.rb +13 -0
- data/lib/faker/sports/chess.rb +90 -0
- data/lib/faker/sports/sport.rb +9 -3
- 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/buffy.rb +0 -13
- data/lib/faker/tv_shows/dr_who.rb +0 -13
- data/lib/faker/tv_shows/south_park.rb +15 -0
- data/lib/faker/tv_shows/spongebob.rb +50 -0
- data/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb +0 -13
- data/lib/faker/version.rb +1 -1
- data/lib/faker.rb +20 -9
- data/lib/helpers/deprecator.rb +118 -0
- data/lib/helpers/positional_generator.rb +480 -0
- data/lib/locales/README.md +18 -2
- data/lib/locales/ar.yml +1 -0
- data/lib/locales/bg.yml +1 -2
- data/lib/locales/da-DK.yml +529 -35
- data/lib/locales/de-AT.yml +3487 -27
- data/lib/locales/de-CH.yml +4359 -12
- data/lib/locales/de.yml +7182 -100
- data/lib/locales/ee.yml +0 -1
- data/lib/locales/en/address.yml +1826 -561
- data/lib/locales/en/airport.yml +381 -0
- data/lib/locales/en/archer.yml +75 -0
- data/lib/locales/en/australia.yml +106 -105
- data/lib/locales/en/avatar.yml +31 -0
- data/lib/locales/en/bank.yml +1 -1
- data/lib/locales/en/chess.yml +103 -0
- data/lib/locales/en/company.yml +1 -0
- data/lib/locales/en/cosmere.yml +1 -1
- data/lib/locales/en/cowboy_bebop.yml +163 -0
- data/lib/locales/en/dnd.yml +186 -1
- data/lib/locales/en/dog.yml +262 -7
- data/lib/locales/en/dota.yml +120 -67
- data/lib/locales/en/final_fantasy_xiv.yml +754 -0
- data/lib/locales/en/finance.yml +4 -4
- data/lib/locales/en/food.yml +14 -1
- data/lib/locales/en/{fma_brotherhood.yml → fullmetal_alchemist_brotherhood.yml} +3 -3
- data/lib/locales/en/harry_potter.yml +1 -1
- data/lib/locales/en/heroes.yml +0 -0
- data/lib/locales/en/id_number.yml +1 -1
- data/lib/locales/en/internet.yml +3 -4
- data/lib/locales/en/minecraft.yml +4 -4
- data/lib/locales/en/mitch_hedberg.yml +46 -0
- data/lib/locales/en/music.yml +25 -25
- data/lib/locales/en/opera.yml +1 -1
- data/lib/locales/en/phone_number.yml +78 -3
- data/lib/locales/en/restaurant.yml +1 -1
- data/lib/locales/en/smashing_pumpkins.yml +382 -0
- data/lib/locales/en/south_park.yml +360 -2
- data/lib/locales/en/spongebob.yml +489 -0
- data/lib/locales/en/star_wars.yml +1 -1
- data/lib/locales/en/{room.yml → the_room.yml} +1 -1
- data/lib/locales/en/{show.yml → theater.yml} +1 -1
- data/lib/locales/en/train_station.yml +280 -0
- data/lib/locales/en/vehicle.yml +1 -1
- data/lib/locales/en-AU.yml +718 -47
- data/lib/locales/en-CA.yml +373 -19
- data/lib/locales/en-GB.yml +116 -8
- data/lib/locales/en-IND.yml +1259 -17
- data/lib/locales/en-KE.yml +212 -0
- data/lib/locales/en-MS.yml +364 -17
- data/lib/locales/en-NEP.yml +212 -38
- data/lib/locales/en-NG.yml +1 -0
- data/lib/locales/en-NZ.yml +1153 -123
- data/lib/locales/en-PAK.yml +392 -10
- data/lib/locales/en-SG.yml +581 -16
- data/lib/locales/en-UG.yml +1 -0
- data/lib/locales/en-US.yml +6914 -74
- data/lib/locales/en-ZA.yml +1 -1
- data/lib/locales/en-au-ocker.yml +266 -22
- data/lib/locales/es-AR.yml +4569 -4599
- data/lib/locales/es-MX.yml +1 -2
- data/lib/locales/es.yml +2 -3
- data/lib/locales/fi-FI.yml +1 -0
- data/lib/locales/fr/address.yml +761 -9
- data/lib/locales/fr/internet.yml +0 -1
- data/lib/locales/fr/name.yml +2 -1
- data/lib/locales/fr-CA.yml +2733 -44
- data/lib/locales/fr-CH.yml +1 -2
- data/lib/locales/fr.yml +3 -1
- data/lib/locales/hy.yml +3624 -119
- data/lib/locales/id.yml +839 -12
- data/lib/locales/it.yml +1304 -32
- data/lib/locales/ja/book.yml +492 -3
- data/lib/locales/ja/football.yml +115 -0
- data/lib/locales/ja/lorem.yml +1 -1
- data/lib/locales/ja/sport.yml +130 -0
- data/lib/locales/ja/super_mario.yml +1 -1
- data/lib/locales/ja/touhou.yml +466 -0
- data/lib/locales/ko.yml +1361 -20
- data/lib/locales/lt.yml +297 -17
- data/lib/locales/lv.yml +0 -1
- data/lib/locales/mi-NZ.yml +2 -0
- data/lib/locales/nb-NO.yml +518 -29
- data/lib/locales/nl.yml +10 -2
- data/lib/locales/pl.yml +1 -2
- data/lib/locales/pt-BR.yml +8205 -664
- data/lib/locales/pt.yml +844 -45
- data/lib/locales/ru.yml +1353 -69
- data/lib/locales/sk.yml +4410 -43
- data/lib/locales/sv.yml +100 -0
- data/lib/locales/tr.yml +1 -2
- data/lib/locales/uk.yml +1808 -44
- data/lib/locales/vi.yml +1 -0
- data/lib/locales/zh-CN/bank.yml +17 -0
- data/lib/locales/zh-CN.yml +1 -0
- data/lib/locales/zh-TW.yml +1 -0
- metadata +37 -156
- data/History.md +0 -176
- data/lib/faker/default/fillmurray.rb +0 -36
- data/lib/faker/default/lorem_pixel.rb +0 -64
data/README.md
CHANGED
@@ -4,76 +4,119 @@
|
|
4
4
|
[](https://github.com/faker-ruby/faker/actions?query=workflow%3ATests)
|
5
5
|
[](https://badge.fury.io/rb/faker)
|
6
6
|
[](https://inch-ci.org/github/faker-ruby/faker)
|
7
|
-
[](https://codeclimate.com/github/stympy/faker/test_coverage)
|
8
|
-
[](https://codeclimate.com/github/stympy/faker/maintainability)
|
9
7
|
|
10
|
-
|
8
|
+
Faker is a port of [Perl's Data::Faker library](https://metacpan.org/pod/Data::Faker).
|
9
|
+
It's a library for generating fake data such as names, addresses, and phone numbers.
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
Faker helps you generate realistic test data, and populate your
|
12
|
+
database with more than a couple of records while you're doing development.
|
13
|
+
|
14
|
+
It comes in very handy for taking screenshots (taking screenshots for a personal project)
|
15
|
+
and it was the original impetus for the creation of this gem.
|
16
|
+
|
17
|
+
## Quick links
|
18
|
+
|
19
|
+
- 📖 **[Read the documentation for the latest version][rubydocs].**
|
20
|
+
- 📢 **[See what's changed in recent versions][changelog].**
|
21
|
+
|
22
|
+
[rubydocs]: https://www.rubydoc.info/gems/faker/
|
23
|
+
[changelog]: CHANGELOG.md
|
24
|
+
|
25
|
+
## In the media
|
26
|
+
|
27
|
+
- 📰 [With Great Humor Comes Great Developer Engagement] - KTH Royal Institute of Technology research
|
28
|
+
- 🎧 [Computer und Kommunikation 4.5.2024, komplette Sendung] - Deutschland Funk Radio Interview
|
29
|
+
|
30
|
+
[With Great Humor Comes Great Developer Engagement]: https://arxiv.org/pdf/2312.01680
|
31
|
+
[Computer und Kommunikation 4.5.2024, komplette Sendung]: https://www.deutschlandfunk.de/computer-und-kommunikation-4-5-2024-komplette-sendung-dlf-16492b03-100.html
|
32
|
+
|
33
|
+
## Table of Contents
|
17
34
|
|
18
35
|
- [Faker](#faker)
|
19
|
-
|
20
|
-
- [
|
36
|
+
- [Quick links](#quick-links)
|
37
|
+
- [Table of Contents](#table-of-contents)
|
38
|
+
- [Notes](#notes)
|
39
|
+
- [Getting Started](#getting-started)
|
21
40
|
- [Usage](#usage)
|
22
|
-
- [
|
41
|
+
- [A note about the Generators versions](#a-note-about-the-generators-versions)
|
23
42
|
- [Ensuring unique values](#ensuring-unique-values)
|
24
43
|
- [Deterministic Random](#deterministic-random)
|
44
|
+
- [Customization](#customization)
|
45
|
+
- [Minitest and Faker \>= 2.22](#minitest-and-faker--222)
|
25
46
|
- [Generators](#generators)
|
26
|
-
- [Default](#default)
|
27
|
-
- [Blockchain](#blockchain)
|
28
|
-
- [Books](#books)
|
29
|
-
- [Fantasy](#fantasy)
|
30
|
-
- [Creature](#creature)
|
31
|
-
- [Games](#games)
|
32
|
-
- [Japanese Media](#japanese-media)
|
33
|
-
- [Movies](#movies)
|
34
|
-
- [Music](#music)
|
35
|
-
- [Quotes](#quotes)
|
36
|
-
- [Sports](#sports)
|
37
|
-
- [Tv Shows](#tv-shows)
|
38
|
-
- [Customization](#customization)
|
39
47
|
- [Contributing](#contributing)
|
40
|
-
- [
|
48
|
+
- [Versioning](#versioning)
|
41
49
|
- [License](#license)
|
42
50
|
|
43
|
-
###
|
51
|
+
### Notes
|
52
|
+
|
44
53
|
* While Faker generates data at random, returned values are not guaranteed to be unique by default.
|
45
|
-
|
46
|
-
Values also can be deterministic if you use the deterministic feature, see [
|
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.
|
54
|
+
To explicitly specify when you require unique values, see [Ensuring Unique Values](#ensuring-unique-values).
|
55
|
+
Values also can be deterministic if you use the deterministic feature, see [Deterministic Random](#deterministic-random)
|
49
56
|
* This is the `main` branch of Faker and may contain changes that are not yet released.
|
50
|
-
Please refer the README of your version for the available methods.
|
51
|
-
|
57
|
+
Please refer to the README of your version for the available methods.
|
58
|
+
The list of all versions is [available here](https://github.com/stympy/faker/releases).
|
52
59
|
|
53
|
-
##
|
54
|
-
|
55
|
-
|
56
|
-
```
|
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:
|
60
|
+
## Getting Started
|
61
|
+
|
62
|
+
Start by including `faker` in your Gemfile:
|
58
63
|
|
59
64
|
```ruby
|
60
|
-
gem 'faker'
|
65
|
+
gem 'faker'
|
61
66
|
```
|
62
67
|
|
68
|
+
Then run `bundle install`.
|
69
|
+
|
63
70
|
## Usage
|
71
|
+
|
72
|
+
Here are some examples of how to use Faker:
|
73
|
+
|
64
74
|
```ruby
|
65
75
|
require 'faker'
|
66
76
|
|
67
77
|
Faker::Name.name #=> "Christophe Bartell"
|
68
78
|
|
69
|
-
Faker::
|
79
|
+
Faker::Address.full_address #=> "5479 William Way, East Sonnyhaven, LA 63637"
|
80
|
+
|
81
|
+
Faker::Markdown.emphasis #=> "Quo qui aperiam. Amet corrupti distinctio. Sit quia *dolor.*"
|
82
|
+
|
83
|
+
Faker::TvShows::RuPaul.queen #=> "Violet Chachki"
|
84
|
+
|
85
|
+
Faker::Alphanumeric.alpha(number: 10) #=> "zlvubkrwga"
|
86
|
+
|
87
|
+
Faker::ProgrammingLanguage.name #=> "Ruby"
|
70
88
|
```
|
71
89
|
|
72
|
-
|
73
|
-
|
90
|
+
For a complete list of the generators, see [Generators](#generators).
|
91
|
+
|
92
|
+
### A note about the Generators versions
|
93
|
+
|
94
|
+
If you get a `uninitialized constant Faker::[some_class]` error, your version of
|
95
|
+
the gem is behind main.
|
96
|
+
|
97
|
+
To make sure that your gem is the one
|
98
|
+
documented here, change the line in your Gemfile to:
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main'
|
102
|
+
```
|
103
|
+
|
104
|
+
The generators have the `@faker.version` tag on top of their implementation.
|
105
|
+
From the tags, you can identify the version the generator was added:
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
# Faker::TvShows::ParksAndRec.character
|
109
|
+
|
110
|
+
# @faker.version 1.9.0
|
111
|
+
def character
|
112
|
+
fetch('parks_and_rec.characters')
|
113
|
+
end
|
114
|
+
```
|
74
115
|
|
75
116
|
### Ensuring unique values
|
76
|
-
|
117
|
+
|
118
|
+
To ensure Faker generates unique values, prefix your method call with `unique`:
|
119
|
+
|
77
120
|
```ruby
|
78
121
|
Faker::Name.unique.name # This will return a unique name every time it is called
|
79
122
|
```
|
@@ -82,6 +125,7 @@ If too many unique values are requested from a generator that has a limited
|
|
82
125
|
number of potential values, a `Faker::UniqueGenerator::RetryLimitExceeded`
|
83
126
|
exception may be raised. It is possible to clear the record of unique values
|
84
127
|
that have been returned, for example between tests.
|
128
|
+
|
85
129
|
```ruby
|
86
130
|
Faker::Name.unique.clear # Clears used values for Faker::Name
|
87
131
|
Faker::UniqueGenerator.clear # Clears used values for all generators
|
@@ -100,7 +144,9 @@ Faker::Lorem.unique.exclude :string, [number: 6], %w[azerty wxcvbn]
|
|
100
144
|
```
|
101
145
|
|
102
146
|
### Deterministic Random
|
103
|
-
|
147
|
+
|
148
|
+
Faker supports seeding of its pseudo-random number generator (PRNG)
|
149
|
+
to provide deterministic output of repeated method calls.
|
104
150
|
|
105
151
|
```ruby
|
106
152
|
Faker::Config.random = Random.new(42)
|
@@ -115,14 +161,47 @@ Faker::Config.random.seed #=> 185180369676275068918401850258677722187
|
|
115
161
|
Faker::Company.bs #=> "cultivate viral synergies"
|
116
162
|
```
|
117
163
|
|
164
|
+
### Customization
|
165
|
+
|
166
|
+
You may want Faker to print information depending on your location in the world.
|
167
|
+
To assist you in this, Faker uses the `I18n` gem to store strings and formats to
|
168
|
+
represent the names and postal codes of the area of your choosing.
|
169
|
+
|
170
|
+
Just set the locale you want as shown below, and Faker will take care of the rest.
|
171
|
+
|
172
|
+
```ruby
|
173
|
+
Faker::Config.locale = 'es'
|
174
|
+
# or
|
175
|
+
Faker::Config.locale = :es
|
176
|
+
```
|
177
|
+
|
178
|
+
To override Faker's locales, and set it on threaded server environments
|
179
|
+
check out the [locales README](lib/locales/README.md).
|
180
|
+
|
181
|
+
### Minitest and Faker >= 2.22
|
182
|
+
|
183
|
+
To prevent Faker (version >= 2.22) from generating duplicate values when using Minitest,
|
184
|
+
you might need to add the following to the `test_helper.rb` or `rails_helper.rb` file:
|
185
|
+
|
186
|
+
```ruby
|
187
|
+
Faker::Config.random = Random.new
|
188
|
+
```
|
189
|
+
|
190
|
+
See [Issue #2534](https://github.com/faker-ruby/faker/issues/2534) for more details.
|
191
|
+
|
118
192
|
## Generators
|
193
|
+
|
194
|
+
This is the full list of generators available with this gem. If you need details about any of them, make sure to consult the documentation.
|
195
|
+
|
119
196
|
**NOTE: Some of the generators below aren't released yet. If you want to use them, change the line in your gemfile to:**
|
120
197
|
|
121
198
|
```ruby
|
122
199
|
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main'
|
123
200
|
```
|
124
201
|
|
125
|
-
|
202
|
+
<details>
|
203
|
+
<summary>Default</summary>
|
204
|
+
|
126
205
|
- [Faker::Address](doc/default/address.md)
|
127
206
|
- [Faker::Alphanumeric](doc/default/alphanumeric.md)
|
128
207
|
- [Faker::Ancient](doc/default/ancient.md)
|
@@ -166,7 +245,6 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
166
245
|
- [Faker::Emotion](doc/default/emotion.md)
|
167
246
|
- [Faker::Esport](doc/default/esport.md)
|
168
247
|
- [Faker::File](doc/default/file.md)
|
169
|
-
- [Faker::Fillmurray](doc/default/fillmurray.md)
|
170
248
|
- [Faker::Finance](doc/default/finance.md)
|
171
249
|
- [Faker::Food](doc/default/food.md)
|
172
250
|
- [Faker::FunnyName](doc/default/funny_name.md)
|
@@ -176,7 +254,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
176
254
|
- [Faker::Hipster](doc/default/hipster.md)
|
177
255
|
- [Faker::Hobby](doc/default/hobby.md)
|
178
256
|
- [Faker::House](doc/default/house.md)
|
179
|
-
- [Faker::
|
257
|
+
- [Faker::IdNumber](doc/default/id_number.md)
|
180
258
|
- [Faker::IndustrySegments](doc/default/industry_segments.md)
|
181
259
|
- [Faker::Internet](doc/default/internet.md)
|
182
260
|
- [Faker::Invoice](doc/default/invoice.md)
|
@@ -185,7 +263,6 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
185
263
|
- [Faker::Kpop](doc/default/kpop.md)
|
186
264
|
- [Faker::Lorem](doc/default/lorem.md)
|
187
265
|
- [Faker::LoremFlickr](doc/default/lorem_flickr.md)
|
188
|
-
- [Faker::LoremPixel](doc/default/lorem_pixel.md)
|
189
266
|
- [Faker::Markdown](doc/default/markdown.md)
|
190
267
|
- [Faker::Marketing](doc/default/marketing.md)
|
191
268
|
- [Faker::Measurement](doc/default/measurement.md)
|
@@ -213,6 +290,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
213
290
|
- [Faker::Superhero](doc/default/superhero.md)
|
214
291
|
- [Faker::Tea](doc/default/tea.md)
|
215
292
|
- [Faker::Team](doc/default/team.md)
|
293
|
+
- [Faker::Theater](doc/default/theater.md)
|
216
294
|
- [Faker::Time](doc/default/time.md)
|
217
295
|
- [Faker::Twitter](doc/default/twitter.md)
|
218
296
|
- [Faker::Types](doc/default/types.md)
|
@@ -221,37 +299,60 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
221
299
|
- [Faker::Verbs](doc/default/verbs.md)
|
222
300
|
- [Faker::VulnerabilityIdentifier](doc/default/vulnerability_identifier.md)
|
223
301
|
- [Faker::WorldCup](doc/default/world_cup.md)
|
302
|
+
</details>
|
303
|
+
|
304
|
+
<details>
|
305
|
+
<summary>Blockchain</summary>
|
224
306
|
|
225
|
-
### Blockchain
|
226
307
|
- [Faker::Blockchain::Aeternity](doc/blockchain/aeternity.md)
|
227
308
|
- [Faker::Blockchain::Bitcoin](doc/blockchain/bitcoin.md)
|
228
309
|
- [Faker::Blockchain::Ethereum](doc/blockchain/ethereum.md)
|
229
310
|
- [Faker::Blockchain::Tezos](doc/blockchain/tezos.md)
|
311
|
+
</details>
|
312
|
+
|
313
|
+
<details>
|
314
|
+
<summary>Books</summary>
|
230
315
|
|
231
|
-
### Books
|
232
316
|
- [Faker::Book](doc/books/book.md)
|
233
317
|
- [Faker::Books::CultureSeries](doc/books/culture_series.md)
|
234
318
|
- [Faker::Books::Dune](doc/books/dune.md)
|
235
319
|
- [Faker::Books::Lovecraft](doc/books/lovecraft.md)
|
236
320
|
- [Faker::Books::TheKingkillerChronicle](doc/books/the_kingkiller_chronicle.md)
|
321
|
+
</details>
|
322
|
+
|
323
|
+
<details>
|
324
|
+
<summary>Fantasy</summary>
|
237
325
|
|
238
|
-
### Fantasy
|
239
326
|
- [Faker::Fantasy::Tolkien](doc/fantasy/tolkien.md)
|
327
|
+
</details>
|
328
|
+
|
329
|
+
<details>
|
330
|
+
<summary>Travel</summary>
|
331
|
+
|
332
|
+
- [Faker:Travel::Airport](doc/travel/airport.md)
|
333
|
+
- [Faker:Travel::TrainStation](doc/travel/train_station.md)
|
334
|
+
</details>
|
335
|
+
|
336
|
+
<details>
|
337
|
+
<summary>Creature</summary>
|
240
338
|
|
241
|
-
### Creature
|
242
339
|
- [Faker::Creature::Animal](doc/creature/animal.md)
|
243
340
|
- [Faker::Creature::Bird](doc/creature/bird.md)
|
244
341
|
- [Faker::Creature::Cat](doc/creature/cat.md)
|
245
342
|
- [Faker::Creature::Dog](doc/creature/dog.md)
|
246
343
|
- [Faker::Creature::Horse](doc/creature/horse.md)
|
344
|
+
</details>
|
345
|
+
|
346
|
+
<details>
|
347
|
+
<summary>Games</summary>
|
247
348
|
|
248
|
-
### Games
|
249
349
|
- [Faker::Game](doc/games/game.md)
|
250
350
|
- [Faker::Games::ClashOfClans](doc/games/clash_of_clans.md)
|
251
351
|
- [Faker::Games::DnD](doc/games/dnd.md)
|
252
352
|
- [Faker::Games::Dota](doc/games/dota.md)
|
253
353
|
- [Faker::Games::ElderScrolls](doc/games/elder_scrolls.md)
|
254
354
|
- [Faker::Games::Fallout](doc/games/fallout.md)
|
355
|
+
- [Faker::Games::FinalFantasyXIV](doc/games/final_fantasy_xiv.md)
|
255
356
|
- [Faker::Games::HalfLife](doc/games/half_life.md)
|
256
357
|
- [Faker::Games::Heroes](doc/games/heroes.md)
|
257
358
|
- [Faker::Games::HeroesOfTheStorm](doc/games/heroes_of_the_storm.md)
|
@@ -269,8 +370,12 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
269
370
|
- [Faker::Games::Witcher](doc/games/witcher.md)
|
270
371
|
- [Faker::Games::WorldOfWarcraft](doc/games/world_of_warcraft.md)
|
271
372
|
- [Faker::Games::Zelda](doc/games/zelda.md)
|
373
|
+
</details>
|
374
|
+
|
375
|
+
<details>
|
376
|
+
<summary>Japanese Media</summary>
|
272
377
|
|
273
|
-
|
378
|
+
- [Faker::JapaneseMedia::CowboyBebop](doc/japanese_media/cowboy_bebop.md)
|
274
379
|
- [Faker::JapaneseMedia::DragonBall](doc/japanese_media/dragon_ball.md)
|
275
380
|
- [Faker::JapaneseMedia::OnePiece](doc/japanese_media/one_piece.md)
|
276
381
|
- [Faker::JapaneseMedia::StudioGhibli](doc/japanese_media/studio_ghibli.md)
|
@@ -278,10 +383,14 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
278
383
|
- [Faker::JapaneseMedia::Naruto](doc/japanese_media/naruto.md)
|
279
384
|
- [Faker::JapaneseMedia::Doraemon](doc/japanese_media/doraemon.md)
|
280
385
|
- [Faker::JapaneseMedia::Conan](doc/japanese_media/conan.md)
|
281
|
-
- [Faker::JapaneseMedia::
|
386
|
+
- [Faker::JapaneseMedia::FullmetalAlchemistBrotherhood](doc/japanese_media/fullmetal_alchemist_brotherhood.md)
|
387
|
+
</details>
|
388
|
+
|
389
|
+
<details>
|
390
|
+
<summary>Movies</summary>
|
282
391
|
|
283
|
-
### Movies
|
284
392
|
- [Faker::Movie](doc/movies/movie.md)
|
393
|
+
- [Faker::Movies::Avatar](doc/movies/avatar.md)
|
285
394
|
- [Faker::Movies::BackToTheFuture](doc/movies/back_to_the_future.md)
|
286
395
|
- [Faker::Movies::Departed](doc/movies/departed.md)
|
287
396
|
- [Faker::Movies::Ghostbusters](doc/movies/ghostbusters.md)
|
@@ -295,8 +404,11 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
295
404
|
- [Faker::Movies::StarWars](doc/movies/star_wars.md)
|
296
405
|
- [Faker::Movies::TRON](doc/movies/tron.md)
|
297
406
|
- [Faker::Movies::VForVendetta](doc/movies/v_for_vendetta.md)
|
407
|
+
</details>
|
408
|
+
|
409
|
+
<details>
|
410
|
+
<summary>Music</summary>
|
298
411
|
|
299
|
-
### Music
|
300
412
|
- [Faker::Music](doc/music/music.md)
|
301
413
|
- [Faker::Music::GratefulDead](doc/music/grateful_dead.md)
|
302
414
|
- [Faker::Music::Hiphop](doc/music/hiphop.md)
|
@@ -306,24 +418,35 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
306
418
|
- [Faker::Music::Prince](doc/music/prince.md)
|
307
419
|
- [Faker::Music::RockBand](doc/music/rock_band.md)
|
308
420
|
- [Faker::Music::Rush](doc/music/rush.md)
|
421
|
+
- [Faker::Music::SmashingPumpkins](doc/music/smashing_pumpkins.md)
|
309
422
|
- [Faker::Music::UmphreysMcgee](doc/music/umphreys_mcgee.md)
|
423
|
+
</details>
|
424
|
+
|
425
|
+
<details>
|
426
|
+
<summary>Quotes</summary>
|
310
427
|
|
311
|
-
### Quotes
|
312
428
|
- [Faker::Quote](doc/quotes/quote.md)
|
313
429
|
- [Faker::Quotes::Chiquito](doc/quotes/chiquito.md)
|
314
430
|
- [Faker::Quotes::Rajnikanth](doc/quotes/rajnikanth.md)
|
315
431
|
- [Faker::Quotes::Shakespeare](doc/quotes/shakespeare.md)
|
432
|
+
</details>
|
316
433
|
|
434
|
+
<details>
|
435
|
+
<summary>Sports</summary>
|
317
436
|
|
318
|
-
|
319
|
-
- [Faker::Sports](doc/sports/sports.md)
|
437
|
+
- [Faker::Sport](doc/sports/sport.md)
|
320
438
|
- [Faker::Sports::Basketball](doc/sports/basketball.md)
|
439
|
+
- [Faker::Sports::Chess](doc/sports/chess.md)
|
321
440
|
- [Faker::Sports::Football](doc/sports/football.md)
|
322
441
|
- [Faker::Sports::Mountaineering](doc/sports/mountaineering.md)
|
323
442
|
- [Faker::Sports::Volleyball](doc/sports/volleyball.md)
|
443
|
+
</details>
|
444
|
+
|
445
|
+
<details>
|
446
|
+
<summary>Tv Shows</summary>
|
324
447
|
|
325
|
-
### Tv Shows
|
326
448
|
- [Faker::TvShows::AquaTeenHungerForce](doc/tv_shows/aqua_teen_hunger_force.md)
|
449
|
+
- [Faker::TvShows::Archer](doc/tv_shows/archer.md)
|
327
450
|
- [Faker::TvShows::BigBangTheory](doc/tv_shows/big_bang_theory.md)
|
328
451
|
- [Faker::TvShows::BojackHorseman](doc/tv_shows/bojack_horseman.md)
|
329
452
|
- [Faker::TvShows::BreakingBad](doc/tv_shows/breaking_bad.md)
|
@@ -347,6 +470,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
347
470
|
- [Faker::TvShows::SiliconValley](doc/tv_shows/silicon_valley.md)
|
348
471
|
- [Faker::TvShows::Simpsons](doc/tv_shows/simpsons.md)
|
349
472
|
- [Faker::TvShows::SouthPark](doc/tv_shows/south_park.md)
|
473
|
+
- [Faker::TvShows::Spongebob](doc/tv_shows/spongebob.md)
|
350
474
|
- [Faker::TvShows::StarTrek](doc/tv_shows/star_trek.md)
|
351
475
|
- [Faker::TvShows::Stargate](doc/tv_shows/stargate.md)
|
352
476
|
- [Faker::TvShows::StrangerThings](doc/tv_shows/stranger_things.md)
|
@@ -358,59 +482,31 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
358
482
|
- [Faker::TvShows::TheThickOfIt](doc/tv_shows/the_thick_of_it.md)
|
359
483
|
- [Faker::TvShows::TwinPeaks](doc/tv_shows/twin_peaks.md)
|
360
484
|
- [Faker::TvShows::VentureBros](doc/tv_shows/venture_bros.md)
|
485
|
+
</details>
|
361
486
|
|
362
|
-
|
363
|
-
|
364
|
-
To assist you in this, Faker uses I18n gem to store strings and formats to
|
365
|
-
represent the names and postal codes of the area of your choosing.
|
366
|
-
Just set the locale you want as shown below, and Faker will take care of the rest.
|
367
|
-
|
368
|
-
```ruby
|
369
|
-
Faker::Config.locale = 'es'
|
370
|
-
# or
|
371
|
-
Faker::Config.locale = :es
|
372
|
-
```
|
487
|
+
<details>
|
488
|
+
<summary>Locations</summary>
|
373
489
|
|
374
|
-
|
375
|
-
|
376
|
-
use locales [here](lib/locales/README.md)
|
377
|
-
|
378
|
-
```yaml
|
379
|
-
en-au-ocker:
|
380
|
-
faker:
|
381
|
-
name:
|
382
|
-
# Existing faker field, new data
|
383
|
-
first_name:
|
384
|
-
- Charlotte
|
385
|
-
- Ava
|
386
|
-
- Chloe
|
387
|
-
- Emily
|
388
|
-
|
389
|
-
# New faker fields
|
390
|
-
ocker_first_name:
|
391
|
-
- Bazza
|
392
|
-
- Bluey
|
393
|
-
- Davo
|
394
|
-
- Johno
|
395
|
-
- Shano
|
396
|
-
- Shazza
|
397
|
-
region:
|
398
|
-
- South East Queensland
|
399
|
-
- Wide Bay Burnett
|
400
|
-
- Margaret River
|
401
|
-
- Port Pirie
|
402
|
-
- Gippsland
|
403
|
-
- Elizabeth
|
404
|
-
- Barossa
|
405
|
-
```
|
490
|
+
- [Faker::Locations::Australia](doc/locations/australia.md)
|
491
|
+
</details>
|
406
492
|
|
407
493
|
## Contributing
|
408
|
-
See [CONTRIBUTING.md](https://github.com/stympy/faker/blob/main/CONTRIBUTING.md).
|
409
494
|
|
410
|
-
|
411
|
-
Comments and feedback are welcome. Send an email to Benjamin Curtis via the [google group](http://groups.google.com/group/ruby-faker).
|
495
|
+
**Note**: We are not accepting proposals for new generators and locales. The [Contributing](https://github.com/faker-ruby/faker/blob/main/CONTRIBUTING.md) guide has a few notes about this decision.
|
412
496
|
|
413
|
-
|
497
|
+
Take a look at the [Contributing](https://github.com/faker-ruby/faker/blob/main/CONTRIBUTING.md) document for
|
498
|
+
instructions on setting up the repo on your machine, opening bug reports, understanding the codebase,
|
499
|
+
and creating a good pull request.
|
500
|
+
|
501
|
+
There is a [Discord channel](https://discord.gg/RMumTwB) to discuss anything
|
502
|
+
regarding improvements or feature requests.
|
503
|
+
|
504
|
+
Thank you, contributors!
|
505
|
+
|
506
|
+
## Versioning
|
507
|
+
|
508
|
+
Faker follows Semantic Versioning 2.0 as defined at https://semver.org.
|
414
509
|
|
415
510
|
## License
|
511
|
+
|
416
512
|
This code is free to use under the terms of the MIT license.
|
@@ -133,10 +133,9 @@ module Faker
|
|
133
133
|
resolved_num = resolve(number)
|
134
134
|
word_list = translate('faker.lovecraft.words')
|
135
135
|
word_list *= ((resolved_num / word_list.length) + 1)
|
136
|
+
words = sample(word_list, resolved_num)
|
137
|
+
return words if spaces_allowed
|
136
138
|
|
137
|
-
return shuffle(word_list)[0, resolved_num] if spaces_allowed
|
138
|
-
|
139
|
-
words = shuffle(word_list)[0, resolved_num]
|
140
139
|
words.each_with_index { |w, i| words[i] = word if w =~ /\s/ }
|
141
140
|
end
|
142
141
|
|
@@ -119,8 +119,8 @@ module Faker
|
|
119
119
|
return numerify(letterified_string, leading_zero: true)
|
120
120
|
end
|
121
121
|
|
122
|
-
# provide a zip code that
|
123
|
-
#
|
122
|
+
# provide a zip code that may be valid for the state provided
|
123
|
+
# note: zip code may appear in the correct format for the state provided but may not be an actual state zip.
|
124
124
|
bothify(fetch("address.postcode_by_state.#{state_abbreviation}"))
|
125
125
|
end
|
126
126
|
|
@@ -8,18 +8,19 @@ module Faker
|
|
8
8
|
##
|
9
9
|
# Produces a random Chilean RUT (Rol Unico Tributario, ID with 8 digits).
|
10
10
|
#
|
11
|
-
# @param min_rut [Integer] Specifies the minimum value of the
|
12
|
-
# @param
|
11
|
+
# @param min_rut [Integer] Specifies the minimum value of the RUT.
|
12
|
+
# @param max_rut [Integer] Specifies the maximum value of the RUT.
|
13
|
+
# @param fixed [Boolean] Determines if the RUT is fixed (returns the min_rut value).
|
13
14
|
# @return [Number]
|
14
15
|
#
|
15
16
|
# @example
|
16
17
|
# Faker::ChileRut.rut #=> 11235813
|
17
|
-
# Faker::ChileRut.rut(min_rut:
|
18
|
-
# Faker::ChileRut.rut(min_rut:
|
18
|
+
# Faker::ChileRut.rut(min_rut: 10_000_000, max_rut: 30_000_000) #=> 21853211
|
19
|
+
# Faker::ChileRut.rut(min_rut: 20_890_156, fixed: true) #=> 20890156
|
19
20
|
#
|
20
|
-
# @faker.version
|
21
|
-
def rut(min_rut: 1, fixed: false)
|
22
|
-
@last_rut = fixed ? min_rut : rand_in_range(min_rut,
|
21
|
+
# @faker.version next
|
22
|
+
def rut(min_rut: 1, max_rut: 99_999_999, fixed: false)
|
23
|
+
@last_rut = fixed ? min_rut : rand_in_range(min_rut, max_rut)
|
23
24
|
end
|
24
25
|
|
25
26
|
##
|
@@ -68,25 +69,30 @@ module Faker
|
|
68
69
|
##
|
69
70
|
# Produces a random Chilean RUT (Rol Unico Tributario, ID with 8 digits) with a dv (digito verificador, check-digit).
|
70
71
|
#
|
71
|
-
# @param min_rut [Integer] Specifies the minimum value of the
|
72
|
-
# @param
|
72
|
+
# @param min_rut [Integer] Specifies the minimum value of the RUT.
|
73
|
+
# @param max_rut [Integer] Specifies the maximum value of the RUT.
|
74
|
+
# @param fixed [Boolean] Determines if the RUT is fixed (returns the min_rut value).
|
73
75
|
# @return [String]
|
74
76
|
#
|
75
77
|
# @example
|
76
78
|
# Faker::ChileRut.full_rut #=> "30686957-4"
|
77
|
-
# Faker::ChileRut.full_rut(min_rut:
|
78
|
-
# Faker::ChileRut.full_rut(min_rut:
|
79
|
+
# Faker::ChileRut.full_rut(min_rut: 10_000_000, max_rut: 30_000_000) #=> "20686957-4"
|
80
|
+
# Faker::ChileRut.full_rut(min_rut: 30_686_957, fixed: true) #=> "30686957-4"
|
79
81
|
#
|
80
82
|
# @faker.version next
|
81
|
-
def full_rut(min_rut:
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
"#{rut(min_rut: min_rut, fixed: fixed)}-#{dv}"
|
86
|
-
end
|
83
|
+
def full_rut(min_rut: 1, max_rut: 99_999_999, fixed: false, formatted: false)
|
84
|
+
this_rut = rut(min_rut: min_rut, max_rut: max_rut, fixed: fixed)
|
85
|
+
this_rut = format_rut(this_rut) if formatted
|
86
|
+
"#{this_rut}-#{dv}"
|
87
87
|
end
|
88
88
|
|
89
89
|
attr_reader :last_rut
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
def format_rut(rut)
|
94
|
+
rut.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1.').reverse
|
95
|
+
end
|
90
96
|
end
|
91
97
|
end
|
92
98
|
end
|