faker 1.8.2 → 1.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -2
- data/README.md +12 -1
- data/lib/faker.rb +7 -1
- data/lib/faker/bossa_nova.rb +13 -0
- data/lib/faker/elder_scrolls.rb +21 -0
- data/lib/faker/family_guy.rb +13 -13
- data/lib/faker/food.rb +4 -0
- data/lib/faker/harry_potter.rb +4 -0
- data/lib/faker/lorem.rb +1 -1
- data/lib/faker/measurement.rb +127 -0
- data/lib/faker/most_interesting_man_in_the_world.rb +9 -0
- data/lib/faker/seinfeld.rb +13 -0
- data/lib/faker/star_wars.rb +7 -4
- data/lib/faker/the_fresh_prince_of_bel_air.rb +17 -0
- data/lib/faker/umphreys_mcgee.rb +9 -0
- data/lib/faker/university.rb +12 -0
- data/lib/faker/venture_bros.rb +21 -0
- data/lib/faker/version.rb +1 -1
- data/lib/faker/witcher.rb +29 -0
- data/lib/faker/world_of_warcraft.rb +13 -0
- data/lib/locales/README.md +41 -0
- data/lib/locales/en.yml +33 -1
- data/lib/locales/en/address.yml +53 -1
- data/lib/locales/en/bossa_nova.yml +6 -0
- data/lib/locales/en/fresh_prince_of_bel_air.yml +73 -0
- data/lib/locales/en/most_interesting_man_in_the_world.yml +106 -0
- data/lib/locales/en/witcher.yml +10 -0
- data/lib/locales/en/world_of_warcraft.yml +7 -0
- data/lib/locales/zh-CN.yml +6 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8c3b8b8e1a5f5e687e287db46c9d56bd2aea687
|
4
|
+
data.tar.gz: 0f2c9422be8bf7e8313be977bc31f3fad42b7eac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97db7863b720ff86ee8c89e27cd25a0a4e63f460f6c0de08ef92f2675ebdf6388364dc18d5b44ad65c98a04d5d40304ea65e46399a37e76bcac274c0b9666a5e
|
7
|
+
data.tar.gz: 509efe89292224f4519158ec6f05a56c3cc3f740b4b0ec9e11939aadd11cb66efd01b9c9974258a1f7458a9a341b68a0b2221c297cb73021d3126a8ae7e06eed
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,26 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [v1.8.
|
3
|
+
## [v1.8.3](https://github.com/stympy/faker/tree/v1.8.3) (2017-07-12)
|
4
|
+
[Full Changelog](https://github.com/stympy/faker/compare/v1.8.2...v1.8.3)
|
5
|
+
|
6
|
+
**Closed issues:**
|
7
|
+
|
8
|
+
- Can't pass zero \(0\) to the default rand method \(Faker override\) [\#976](https://github.com/stympy/faker/issues/976)
|
9
|
+
- Add Faker::Address.mailing\_address [\#841](https://github.com/stympy/faker/issues/841)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Fix tests warnings [\#979](https://github.com/stympy/faker/pull/979) ([gssbzn](https://github.com/gssbzn))
|
14
|
+
- \[\#976\] Handles zero as max for rand [\#978](https://github.com/stympy/faker/pull/978) ([gssbzn](https://github.com/gssbzn))
|
15
|
+
- Fix spelling of Wookiee [\#977](https://github.com/stympy/faker/pull/977) ([miloprice](https://github.com/miloprice))
|
16
|
+
- Faker: Umphreys mcgee [\#942](https://github.com/stympy/faker/pull/942) ([Ryanspink1](https://github.com/Ryanspink1))
|
17
|
+
- Faker: Venture bros [\#940](https://github.com/stympy/faker/pull/940) ([Ryanspink1](https://github.com/Ryanspink1))
|
18
|
+
- seinfeld faker [\#936](https://github.com/stympy/faker/pull/936) ([cews7](https://github.com/cews7))
|
19
|
+
- elder scrolls faker [\#933](https://github.com/stympy/faker/pull/933) ([CjMoore](https://github.com/CjMoore))
|
20
|
+
- Add greek\_organization method to University Faker [\#932](https://github.com/stympy/faker/pull/932) ([andrewdwooten](https://github.com/andrewdwooten))
|
21
|
+
- add Hogwarts and Ilvermorny houses to Harry Potter faker [\#925](https://github.com/stympy/faker/pull/925) ([samanthamorco](https://github.com/samanthamorco))
|
22
|
+
|
23
|
+
## [v1.8.2](https://github.com/stympy/faker/tree/v1.8.2) (2017-07-11)
|
4
24
|
[Full Changelog](https://github.com/stympy/faker/compare/v1.8.1...v1.8.2)
|
5
25
|
|
6
26
|
**Closed issues:**
|
@@ -138,7 +158,7 @@
|
|
138
158
|
- Fixed russian locale [\#813](https://github.com/stympy/faker/pull/813) ([fobo66](https://github.com/fobo66))
|
139
159
|
- Allow unique values to be cleared [\#810](https://github.com/stympy/faker/pull/810) ([dslh](https://github.com/dslh))
|
140
160
|
- Friends info [\#808](https://github.com/stympy/faker/pull/808) ([ktrant84](https://github.com/ktrant84))
|
141
|
-
- Update superhero.md [\#805](https://github.com/stympy/faker/pull/805) ([
|
161
|
+
- Update superhero.md [\#805](https://github.com/stympy/faker/pull/805) ([VitaliyFry](https://github.com/VitaliyFry))
|
142
162
|
- adds Zelda [\#800](https://github.com/stympy/faker/pull/800) ([audy](https://github.com/audy))
|
143
163
|
- Remove the word 'fap' [\#798](https://github.com/stympy/faker/pull/798) ([probablycorey](https://github.com/probablycorey))
|
144
164
|
- en.yml: fix typo in demographic race [\#797](https://github.com/stympy/faker/pull/797) ([PascalSchumacher](https://github.com/PascalSchumacher))
|
data/README.md
CHANGED
@@ -32,6 +32,7 @@ Contents
|
|
32
32
|
- [Faker::Bitcoin](doc/bitcoin.md)
|
33
33
|
- [Faker::Book](doc/book.md)
|
34
34
|
- [Faker::Boolean](doc/boolean.md)
|
35
|
+
- [Faker::BossaNova](doc/bossa_nova.md)
|
35
36
|
- [Faker::Business](doc/business.md)
|
36
37
|
- [Faker::Cat](doc/cat.md)
|
37
38
|
- [Faker::ChuckNorris](doc/chuck_norris.md)
|
@@ -48,6 +49,7 @@ Contents
|
|
48
49
|
- [Faker::DragonBall](doc/dragon_ball.md)
|
49
50
|
- [Faker::DrWho](doc/dr_who.md)
|
50
51
|
- [Faker::Educator](doc/educator.md)
|
52
|
+
- [Faker::ElderScrolls](doc/elder_scrolls.md)
|
51
53
|
- [Faker::FamilyGuy](doc/family_guy.md)
|
52
54
|
- [Faker::File](doc/file.md)
|
53
55
|
- [Faker::Fillmurray](doc/fillmurray.md)
|
@@ -70,6 +72,8 @@ Contents
|
|
70
72
|
- [Faker::Lovecraft](doc/lovecraft.md)
|
71
73
|
- [Faker::Markdown](doc/markdown.md)
|
72
74
|
- [Faker::Matz](doc/matz.md)
|
75
|
+
- [Faker::Measurement](doc/measurement.md)
|
76
|
+
- [Faker::MostInterestingManInTheWorld](doc/most_interesting_man_in_the_world.md)
|
73
77
|
- [Faker::Movie](doc/movie.md)
|
74
78
|
- [Faker::Music](doc/music.md)
|
75
79
|
- [Faker::Name](doc/name.md)
|
@@ -83,6 +87,7 @@ Contents
|
|
83
87
|
- [Faker::Robin](doc/robin.md)
|
84
88
|
- [Faker::RockBand](doc/rock_band.md)
|
85
89
|
- [Faker::RuPaul](doc/rupaul.md)
|
90
|
+
- [Faker::Seinfeld](doc/seinfeld.md)
|
86
91
|
- [Faker::Simpsons](doc/simpsons.md)
|
87
92
|
- [Faker::SlackEmoji](doc/slack_emoji.md)
|
88
93
|
- [Faker::Space](doc/space.md)
|
@@ -90,11 +95,16 @@ Contents
|
|
90
95
|
- [Faker::StarWars](doc/star_wars.md)
|
91
96
|
- [Faker::Superhero](doc/superhero.md)
|
92
97
|
- [Faker::Team](doc/team.md)
|
98
|
+
- [Faker::TheFreshPrinceOfBelAir](doc/the_fresh_prince_of_bel_air.md)
|
93
99
|
- [Faker::Time](doc/time.md)
|
94
100
|
- [Faker::TwinPeaks](doc/twin_peaks.md)
|
95
101
|
- [Faker::Twitter](doc/twitter.md)
|
102
|
+
- [Faker::UmphreysMcgee](doc/umphreys_mcgee.md)
|
96
103
|
- [Faker::University](doc/university.md)
|
97
104
|
- [Faker::Vehicle](doc/vehicle.md)
|
105
|
+
- [Faker::VentureBros](doc/venture_bros.md)
|
106
|
+
- [Faker::Witcher](doc/witcher.md)
|
107
|
+
- [Faker::WorldOfWarcraft](doc/world_of_warcraft.md)
|
98
108
|
- [Faker::Zelda](doc/zelda.md)
|
99
109
|
- [Customization](#customization)
|
100
110
|
- [Contributing](#contributing)
|
@@ -165,7 +175,8 @@ Faker::Config.locale to the locale you want, and Faker will take care of the
|
|
165
175
|
rest.
|
166
176
|
|
167
177
|
If your locale doesn't already exist, create it in the \lib\locales\ directory
|
168
|
-
and you can then override or add elements to suit
|
178
|
+
and you can then override or add elements to suit your needs. See more about how to
|
179
|
+
use locales [here](lib/locales/README.md)
|
169
180
|
|
170
181
|
```yaml
|
171
182
|
|
data/lib/faker.rb
CHANGED
@@ -205,7 +205,13 @@ module Faker
|
|
205
205
|
end
|
206
206
|
|
207
207
|
def rand(max = nil)
|
208
|
-
|
208
|
+
if max.nil?
|
209
|
+
Faker::Config.random.rand
|
210
|
+
elsif max.is_a?(Range) || max.to_i > 0
|
211
|
+
Faker::Config.random.rand(max)
|
212
|
+
else
|
213
|
+
0
|
214
|
+
end
|
209
215
|
end
|
210
216
|
end
|
211
217
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Faker
|
2
|
+
class ElderScrolls < Base
|
3
|
+
class << self
|
4
|
+
def race
|
5
|
+
fetch('elder_scrolls.race')
|
6
|
+
end
|
7
|
+
|
8
|
+
def creature
|
9
|
+
fetch('elder_scrolls.creature')
|
10
|
+
end
|
11
|
+
|
12
|
+
def region
|
13
|
+
fetch('elder_scrolls.region')
|
14
|
+
end
|
15
|
+
|
16
|
+
def dragon
|
17
|
+
fetch('elder_scrolls.dragon')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/faker/family_guy.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
module Faker
|
2
2
|
class FamilyGuy < Base
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
class << self
|
4
|
+
def character
|
5
|
+
fetch('family_guy.character')
|
6
|
+
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
def location
|
9
|
+
fetch('family_guy.location')
|
10
|
+
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
def quote
|
13
|
+
fetch('family_guy.quote')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/faker/food.rb
CHANGED
data/lib/faker/harry_potter.rb
CHANGED
data/lib/faker/lorem.rb
CHANGED
@@ -45,7 +45,7 @@ module Faker
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def question(word_count = 4, supplemental = false, random_words_to_add = 6)
|
48
|
-
words(word_count + rand(random_words_to_add.to_i)
|
48
|
+
words(word_count + rand(random_words_to_add.to_i), supplemental).join(' ').capitalize + '?'
|
49
49
|
end
|
50
50
|
|
51
51
|
def questions(question_count = 3, supplemental = false)
|
@@ -0,0 +1,127 @@
|
|
1
|
+
module Faker
|
2
|
+
class Measurement < Base
|
3
|
+
class << self
|
4
|
+
ALL = "all"
|
5
|
+
NONE = "none"
|
6
|
+
|
7
|
+
def height(amount = rand(10))
|
8
|
+
ensure_valid_amount(amount)
|
9
|
+
if amount == ALL
|
10
|
+
make_plural(fetch('measurement.height'))
|
11
|
+
elsif amount == NONE
|
12
|
+
fetch('measurement.height')
|
13
|
+
else
|
14
|
+
"#{amount.to_s} #{check_for_plural(fetch('measurement.height'), amount)}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def length(amount = rand(10))
|
19
|
+
ensure_valid_amount(amount)
|
20
|
+
if amount == ALL
|
21
|
+
make_plural(fetch('measurement.length'))
|
22
|
+
elsif amount == NONE
|
23
|
+
fetch('measurement.length')
|
24
|
+
else
|
25
|
+
"#{amount.to_s} #{check_for_plural(fetch('measurement.length'), amount)}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def volume(amount = rand(10))
|
30
|
+
ensure_valid_amount(amount)
|
31
|
+
if amount == ALL
|
32
|
+
make_plural(fetch('measurement.volume'))
|
33
|
+
elsif amount == NONE
|
34
|
+
fetch('measurement.volume')
|
35
|
+
else
|
36
|
+
"#{amount.to_s} #{check_for_plural(fetch('measurement.volume'), amount)}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def weight(amount = rand(10))
|
41
|
+
ensure_valid_amount(amount)
|
42
|
+
if amount == ALL
|
43
|
+
make_plural(fetch('measurement.weight'))
|
44
|
+
elsif amount == NONE
|
45
|
+
fetch('measurement.weight')
|
46
|
+
else
|
47
|
+
"#{amount.to_s} #{check_for_plural(fetch('measurement.weight'), amount)}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def metric_height(amount = rand(10))
|
52
|
+
ensure_valid_amount(amount)
|
53
|
+
if amount == ALL
|
54
|
+
make_plural(fetch('measurement.height'))
|
55
|
+
elsif amount == NONE
|
56
|
+
fetch('measurement.height')
|
57
|
+
else
|
58
|
+
"#{amount.to_s} #{check_for_plural(fetch('measurement.height'), amount)}"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def metric_length(amount = rand(10))
|
63
|
+
ensure_valid_amount(amount)
|
64
|
+
if amount == ALL
|
65
|
+
make_plural(fetch('measurement.length'))
|
66
|
+
elsif amount == NONE
|
67
|
+
fetch('measurement.length')
|
68
|
+
else
|
69
|
+
"#{amount.to_s} #{check_for_plural(fetch('measurement.length'), amount)}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def metric_volume(amount = rand(10))
|
74
|
+
ensure_valid_amount(amount)
|
75
|
+
if amount == ALL
|
76
|
+
make_plural(fetch('measurement.volume'))
|
77
|
+
elsif amount == NONE
|
78
|
+
fetch('measurement.volume')
|
79
|
+
else
|
80
|
+
"#{amount.to_s} #{check_for_plural(fetch('measurement.volume'), amount)}"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def metric_weight(amount = rand(10))
|
85
|
+
ensure_valid_amount(amount)
|
86
|
+
if amount == ALL
|
87
|
+
make_plural(fetch('measurement.weight'))
|
88
|
+
elsif amount == NONE
|
89
|
+
fetch('measurement.weight')
|
90
|
+
else
|
91
|
+
"#{amount.to_s} #{check_for_plural(fetch('measurement.weight'), amount)}"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
private
|
96
|
+
|
97
|
+
def ensure_valid_amount(amount)
|
98
|
+
unless amount == NONE || amount == ALL || amount.is_a?(Integer) || amount.is_a?(Float)
|
99
|
+
raise ArgumentError, 'invalid amount'
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def check_for_plural(text, number)
|
104
|
+
if number && number != 1
|
105
|
+
make_plural(text)
|
106
|
+
else
|
107
|
+
text
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def make_plural(text)
|
112
|
+
case text
|
113
|
+
when "foot"
|
114
|
+
"feet"
|
115
|
+
when "inch"
|
116
|
+
"inches"
|
117
|
+
when "fluid ounce"
|
118
|
+
"fluid ounces"
|
119
|
+
when "metric ton"
|
120
|
+
"metric tons"
|
121
|
+
else
|
122
|
+
"#{text}s"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
data/lib/faker/star_wars.rb
CHANGED
@@ -25,10 +25,10 @@ module Faker
|
|
25
25
|
sample(vehicles)
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
29
|
-
sentence = sample(
|
28
|
+
def wookiee_sentence
|
29
|
+
sentence = sample(wookiee_words).capitalize
|
30
30
|
|
31
|
-
rand(0..10).times { sentence += " " + sample(
|
31
|
+
rand(0..10).times { sentence += " " + sample(wookiee_words)}
|
32
32
|
|
33
33
|
sentence + sample(['.','?','!'])
|
34
34
|
end
|
@@ -71,10 +71,13 @@ module Faker
|
|
71
71
|
'Sith Infiltrator', 'AT-ST Walker', 'TIE Bomber', 'Imperial Shuttle', 'Sandcrawler', 'TIE Interceptor', 'Speeder Bike', 'Death Star', 'AT-AT Walker', 'Imperial Star Destroyer', 'X-Wing Fighter']
|
72
72
|
end
|
73
73
|
|
74
|
-
def
|
74
|
+
def wookiee_words
|
75
75
|
['wyaaaaaa', 'ruh', 'huewaa', 'muaa', 'mumwa', 'wua', 'ga', 'ma', 'ahuma', 'ooma', 'youw', 'kabukk', 'wyogg',
|
76
76
|
'gwyaaaag', 'roooarrgh', 'ur', 'ru', 'roo', 'hnn-rowr', 'yrroonn', 'nng', 'rarr']
|
77
77
|
end
|
78
|
+
|
79
|
+
alias_method :wookie_sentence, :wookiee_sentence
|
80
|
+
alias_method :wookie_words, :wookiee_words
|
78
81
|
end
|
79
82
|
end
|
80
83
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Faker
|
2
|
+
class TheFreshPrinceOfBelAir < Base
|
3
|
+
class << self
|
4
|
+
def character
|
5
|
+
fetch('the_fresh_prince_of_bel_air.characters')
|
6
|
+
end
|
7
|
+
|
8
|
+
def celebrity
|
9
|
+
fetch('the_fresh_prince_of_bel_air.celebrities')
|
10
|
+
end
|
11
|
+
|
12
|
+
def quote
|
13
|
+
fetch('the_fresh_prince_of_bel_air.quotes')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/faker/university.rb
CHANGED
@@ -15,6 +15,18 @@ module Faker
|
|
15
15
|
fetch('university.suffix')
|
16
16
|
end
|
17
17
|
|
18
|
+
def greek_organization
|
19
|
+
organization = ''
|
20
|
+
3.times do |e|
|
21
|
+
organization = organization + sample(greek_alphabet)
|
22
|
+
end
|
23
|
+
organization
|
24
|
+
end
|
25
|
+
|
26
|
+
def greek_alphabet
|
27
|
+
['Α', 'B', 'Γ', 'Δ', 'E', 'Z', 'H', 'Θ', '|', 'K', 'Λ', 'M', 'N', 'Ξ',
|
28
|
+
'O', 'Π', 'P', 'Σ', 'T', 'Y', 'Φ', 'X', 'Ψ', 'Ω']
|
29
|
+
end
|
18
30
|
end
|
19
31
|
end
|
20
32
|
end
|