faker 2.16.0 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +57 -27
- data/README.md +1 -0
- data/lib/faker/blockchain/bitcoin.rb +2 -2
- data/lib/faker/blockchain/tezos.rb +2 -2
- data/lib/faker/default/bank.rb +17 -1
- data/lib/faker/default/crypto.rb +4 -4
- data/lib/faker/default/educator.rb +13 -0
- data/lib/faker/default/number.rb +22 -5
- data/lib/faker/default/types.rb +4 -3
- data/lib/faker/version.rb +1 -1
- data/lib/helpers/unique_generator.rb +0 -3
- data/lib/locales/en/device.yml +112 -4
- data/lib/locales/en/educator.yml +6 -0
- data/lib/locales/en/shakespeare.yml +21 -24
- data/lib/locales/es-AR.yml +4603 -0
- data/lib/locales/ja.yml +8 -0
- metadata +15 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 057f887ea424391e1a5e3c354c93435061ed58b21e6d96c8406a3caa2c53a114
|
4
|
+
data.tar.gz: 5c33ffaafb3374a76feaab9f83f03e3815e1fa5503b4aeddd40726a2fc3f5d41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d117b98af058311ad015475303910e4d0761119eb171d544760d3687fb8b2eb8ffe791c44d39db1bd5244260fb8ca04f8e19923fdb1edee4dc4876b44388bf5e
|
7
|
+
data.tar.gz: cbf27dfec7b156d23eabb2136b2a265baee51b7673e8ae1ff063310fbfdc57402558574d94648ee764ba8ecc1ed732704ddfec70ec6118eaf4fb1b536cb5c039
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,35 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v2.17.0](https://github.com/faker-ruby/faker/tree/v2.17.0) (2020-03-10)
|
4
|
+
|
5
|
+
## Chores
|
6
|
+
|
7
|
+
- [PR #2272](https://github.com/faker-ruby/faker/pull/2272) Bump RuboCop to 1.10.0 [@koic](https://github.com/koic)
|
8
|
+
- [PR #2270](https://github.com/faker-ruby/faker/pull/2270) Generate different values when generating a hash [@DaniTheLion](https://github.com/DaniTheLion)
|
9
|
+
- [PR #2236](https://github.com/faker-ruby/faker/pull/2236) Move Digest classes to OpenSSL [@dbussink](https://github.com/dbussink)
|
10
|
+
|
11
|
+
## Documentation
|
12
|
+
|
13
|
+
- [PR #2277](https://github.com/faker-ruby/faker/pull/2277) add Hip Hop To Path [@Josiassejod1](https://github.com/Josiassejod1)
|
14
|
+
- [PR #2276](https://github.com/faker-ruby/faker/pull/2276) Fix syntax highlighting and missing version [@ghiculescu](https://github.com/ghiculescu)
|
15
|
+
- [PR #2255](https://github.com/faker-ruby/faker/pull/2255) Correct capitalization of RuboCop in text [@jdufresne](https://github.com/jdufresne)
|
16
|
+
- [PR #2204](https://github.com/faker-ruby/faker/pull/2204) update documentation to include Float type [@BigBigDoudou](https://github.com/BigBigDoudou)
|
17
|
+
|
18
|
+
## Feature Request
|
19
|
+
|
20
|
+
- [PR #2256](https://github.com/faker-ruby/faker/pull/2256) Add Faker::Educator.primary_school [@jdufresne](https://github.com/jdufresne)
|
21
|
+
- [PR #2248](https://github.com/faker-ruby/faker/pull/2248) Add Bank.iban_country_code [@mastermatt](https://github.com/mastermatt)
|
22
|
+
- [PR #2166](https://github.com/faker-ruby/faker/pull/2166) add binary number faker [@gabrielbaldao](https://github.com/gabrielbaldao)
|
23
|
+
|
24
|
+
## Update locales
|
25
|
+
|
26
|
+
- [PR #2275](https://github.com/faker-ruby/faker/pull/2275) Add Japanese for Faker::Games::Orverwatch [@may-solty](https://github.com/may-solty)
|
27
|
+
- [PR #2268](https://github.com/faker-ruby/faker/pull/2268) Add Japanese for Faker::Games::SuperMario [@k-maekawa](https://github.com/k-maekawa)
|
28
|
+
- [PR #2258](https://github.com/faker-ruby/faker/pull/2258) Add es-AR locale [@fcolacilli](https://github.com/fcolacilli)
|
29
|
+
- [PR #2215](https://github.com/faker-ruby/faker/pull/2215) Unify model names to not contain manufacturer name [@berkos](https://github.com/berkos)
|
30
|
+
|
31
|
+
------------------------------------------------------------------------------
|
32
|
+
|
3
33
|
## [v2.16.0](https://github.com/faker-ruby/faker/tree/v2.16.0) (2020-02-09)
|
4
34
|
|
5
35
|
## Chores
|
@@ -41,7 +71,7 @@
|
|
41
71
|
|
42
72
|
## Bug/Fixes
|
43
73
|
|
44
|
-
-
|
74
|
+
- RuboCop 1.0 fixes [#2182](https://github.com/faker-ruby/faker/pull/2182) @amatsuda
|
45
75
|
- Get rid of broken I18n locales configuration for the tests [#2168](https://github.com/faker-ruby/faker/pull/2168) @amatsuda
|
46
76
|
- Fixes a bug when generating a password with min_length eq 1 [#2138](https://github.com/faker-ruby/faker/pull/2138) @adrian-rivera @Zeragamba
|
47
77
|
- Improve Faker::Company.spanish_organisation_number [#2106](https://github.com/faker-ruby/faker/pull/2106)
|
@@ -108,13 +138,13 @@
|
|
108
138
|
|
109
139
|
## Update local dependencies
|
110
140
|
|
111
|
-
- Update
|
112
|
-
- Update
|
113
|
-
- Update
|
114
|
-
- Update
|
115
|
-
- Update
|
116
|
-
- Update
|
117
|
-
- Update
|
141
|
+
- Update RuboCop requirement from = 1.0.0 to = 1.1.0 [#2185](https://github.com/faker-ruby/faker/pull/2185)
|
142
|
+
- Update RuboCop requirement from = 0.93.1 to = 1.0.0 [#2172](https://github.com/faker-ruby/faker/pull/2172)
|
143
|
+
- Update RuboCop requirement from = 0.93.0 to = 0.93.1 [#2156](https://github.com/faker-ruby/faker/pull/2156)
|
144
|
+
- Update RuboCop requirement from = 0.92.0 to = 0.93.0 [#2151](https://github.com/faker-ruby/faker/pull/2151)
|
145
|
+
- Update RuboCop requirement from = 0.91.1 to = 0.92.0 [#2129](https://github.com/faker-ruby/faker/pull/2129)
|
146
|
+
- Update RuboCop requirement from = 0.91.0 to = 0.91.1 [#2126](https://github.com/faker-ruby/faker/pull/2126)
|
147
|
+
- Update RuboCop requirement from = 0.90.0 to = 0.91.0 [#2122](https://github.com/faker-ruby/faker/pull/2122)
|
118
148
|
- Update test-unit requirement from = 3.3.6 to = 3.3.7 [#2195](https://github.com/faker-ruby/faker/pull/2195)
|
119
149
|
- Update timecop requirement from = 0.9.1 to = 0.9.2 [#2160](https://github.com/faker-ruby/faker/pull/2160)
|
120
150
|
|
@@ -161,9 +191,9 @@
|
|
161
191
|
|
162
192
|
Update local dependencies
|
163
193
|
|
164
|
-
- Update
|
165
|
-
- Update
|
166
|
-
- Update
|
194
|
+
- Update RuboCop requirement from = 0.87.1 to = 0.88.0 (#2080)
|
195
|
+
- Update RuboCop requirement from = 0.87.0 to = 0.87.1 (#2075)
|
196
|
+
- Update RuboCop requirement from = 0.86.0 to = 0.87.0 (#2074)
|
167
197
|
- Bumps i18n from 1.8.4 to 1.8.5 (#2089)
|
168
198
|
- Bumps i18n from 1.8.3 to 1.8.4 (#2083)
|
169
199
|
|
@@ -233,8 +263,8 @@ This version:
|
|
233
263
|
|
234
264
|
## Update local dependencies
|
235
265
|
|
236
|
-
- Update
|
237
|
-
- Update
|
266
|
+
- Update RuboCop requirement from = 0.81.0 to = 0.85.1
|
267
|
+
- Update RuboCop requirement from = 0.85.1 to = 0.86.0 (#2066)
|
238
268
|
- Update test-unit requirement from = 3.3.5 to = 3.3.6 (#2046)
|
239
269
|
- Bump i18n from 1.8.2 to 1.8.3 (#2034)
|
240
270
|
|
@@ -323,7 +353,7 @@ This version:
|
|
323
353
|
## Update local dependencies
|
324
354
|
|
325
355
|
- Update minitest requirement from = 5.14.0 to = 5.14.1 (#1987)
|
326
|
-
- Update
|
356
|
+
- Update RuboCop requirement from = 0.80.1 to = 0.81.0 (#1955)
|
327
357
|
- Update pry requirement from = 0.13.0 to = 0.13.1 (#1963)
|
328
358
|
- Update yard requirement from = 0.9.24 to = 0.9.25 (#1970)
|
329
359
|
|
@@ -355,8 +385,8 @@ This version:
|
|
355
385
|
## Update local dependencies
|
356
386
|
|
357
387
|
- Update pry requirement from = 0.12.2 to = 0.13.0 (#1951)
|
358
|
-
- Update
|
359
|
-
- Update
|
388
|
+
- Update RuboCop requirement from = 0.80.0 to = 0.80.1 (#1941)
|
389
|
+
- Update RuboCop requirement from = 0.79.0 to = 0.80.0 (#1937)
|
360
390
|
|
361
391
|
------------------------------------------------------------------------------
|
362
392
|
|
@@ -428,7 +458,7 @@ This version:
|
|
428
458
|
- Bump i18n from 1.8.0 to 1.8.1 (#1895)
|
429
459
|
- Update i18n requirement from >= 1.6, < 1.8 to >= 1.6, < 1.9 (#1893)
|
430
460
|
- Update yard requirement from = 0.9.23 to = 0.9.24 (#1892)
|
431
|
-
- Update
|
461
|
+
- Update RuboCop requirement from = 0.78.0 to = 0.79.0 (#1890)
|
432
462
|
- Update yard requirement from = 0.9.22 to = 0.9.23 (#1889)
|
433
463
|
- Update yard requirement from = 0.9.20 to = 0.9.22 (#1882)
|
434
464
|
|
@@ -467,7 +497,7 @@ This version:
|
|
467
497
|
|
468
498
|
## Update local dependencies
|
469
499
|
|
470
|
-
Update
|
500
|
+
Update RuboCop requirement from = 0.77.0 to = 0.78.0 (#1869)
|
471
501
|
|
472
502
|
------------------------------------------------------------------------------
|
473
503
|
|
@@ -523,7 +553,7 @@ This version:
|
|
523
553
|
|
524
554
|
## Update local dependencies
|
525
555
|
|
526
|
-
- Update
|
556
|
+
- Update RuboCop requirement from = 0.76.0 to = 0.77.0 (#1843)
|
527
557
|
|
528
558
|
------------------------------------------------------------------------------
|
529
559
|
|
@@ -594,8 +624,8 @@ This version:
|
|
594
624
|
|
595
625
|
## Update local dependencies
|
596
626
|
|
597
|
-
- Update
|
598
|
-
- Update
|
627
|
+
- Update RuboCop requirement from = 0.75.0 to = 0.75.1 (#1811)
|
628
|
+
- Update RuboCop requirement from = 0.75.1 to = 0.76.0 (#1822)
|
599
629
|
- Update minitest requirement from = 5.12.2 to = 5.13.0 (#1823)
|
600
630
|
|
601
631
|
------------------------------------------------------------------------------
|
@@ -637,7 +667,7 @@ This version introduces:
|
|
637
667
|
|
638
668
|
## Documentation
|
639
669
|
|
640
|
-
- [PR #1771](https://github.com/faker-ruby/faker/pull/1771) Fix some
|
670
|
+
- [PR #1771](https://github.com/faker-ruby/faker/pull/1771) Fix some RuboCop comments that were showing up in YARD docs. [@connorshea](https://github.com/connorshea)
|
641
671
|
- [PR #1767](https://github.com/faker-ruby/faker/pull/1767) Fix two incorrect flexible method calls. [@connorshea](https://github.com/connorshea)
|
642
672
|
- [PR #1761](https://github.com/faker-ruby/faker/pull/1761) Add YARD docs for the Basketball and Football fakers. [@connorshea](https://github.com/connorshea)
|
643
673
|
- [PR #1768](https://github.com/faker-ruby/faker/pull/1768) Add YARD docs for Faker::Restaurant. [@connorshea](https://github.com/connorshea)
|
@@ -710,7 +740,7 @@ The following development dependencies were updated:
|
|
710
740
|
|
711
741
|
## Chores
|
712
742
|
|
713
|
-
- [PR #1724](https://github.com/faker-ruby/faker/pull/1724) Include
|
743
|
+
- [PR #1724](https://github.com/faker-ruby/faker/pull/1724) Include RuboCop-faker autocorrect in deprecation [@koic](https://github.com/koic)
|
714
744
|
|
715
745
|
## Documentation
|
716
746
|
|
@@ -721,7 +751,7 @@ The following development dependencies were updated:
|
|
721
751
|
|
722
752
|
The following development dependencies were updated:
|
723
753
|
- rake requirement from = 12.3.1 to = 12.3.3 (#1719)
|
724
|
-
-
|
754
|
+
- RuboCop requirement from = 0.59.1 to = 0.74.0 (#1721)
|
725
755
|
- simplecov requirement from = 0.16.1 to = 0.17.0 (#1718)
|
726
756
|
|
727
757
|
------------------------------------------------------------------------------
|
@@ -1076,7 +1106,7 @@ Fix lib/faker/version.rb
|
|
1076
1106
|
- [PR #1477](https://github.com/stympy/faker/pull/1477) Fixed bank account length [@jguthrie100](https://github.com/jguthrie100)
|
1077
1107
|
- [PR #1494](https://github.com/stympy/faker/pull/1494) Fix Faker::Internet.ip_v4_address to include all IP ranges [@lucasqueiroz](https://github.com/lucasqueiroz)
|
1078
1108
|
- [PR #1456](https://github.com/stympy/faker/pull/1456) fix: omit . from slug [@ivanoblomov](https://github.com/ivanoblomov)
|
1079
|
-
- [PR #1436](https://github.com/stympy/faker/pull/1436) Fix regex and add magic string to pass
|
1109
|
+
- [PR #1436](https://github.com/stympy/faker/pull/1436) Fix regex and add magic string to pass RuboCop check [@jakrzus](https://github.com/jakrzus)
|
1080
1110
|
- [PR #1425](https://github.com/stympy/faker/pull/1425) NHS: fix occasional bad numbers [@ChaoticBoredom](https://github.com/ChaoticBoredom)
|
1081
1111
|
- [PR #1421](https://github.com/stympy/faker/pull/1421) Faker::Internet.user_name can't handle UTF-8 arguments [@ivanoblomov](https://github.com/ivanoblomov)
|
1082
1112
|
- [PR #1423](https://github.com/stympy/faker/pull/1423) Add missing locale tests - Part II [@vbrazo](https://github.com/vbrazo)
|
@@ -1304,7 +1334,7 @@ Fix lib/faker/version.rb
|
|
1304
1334
|
- [PR #1179](https://github.com/stympy/faker/pull/1179) Random color with Placeholdit [@nicolas-brousse](https://github.com/nicolas-brousse)
|
1305
1335
|
- [PR #1190](https://github.com/stympy/faker/pull/1190) Add Nation object, its specs and docs [@gkunwar](https://github.com/gkunwar)
|
1306
1336
|
- [PR #1210](https://github.com/stympy/faker/pull/1210) Add coveralls [@vbrazo](https://github.com/vbrazo)
|
1307
|
-
- [PR #924](https://github.com/stympy/faker/pull/924)
|
1337
|
+
- [PR #924](https://github.com/stympy/faker/pull/924) RuboCop + fixes [@stephengroat](https://github.com/stephengroat)
|
1308
1338
|
- [PR #900](https://github.com/stympy/faker/pull/900) Add Japanese lorem words to locale [@vietqhoang](https://github.com/vietqhoang)
|
1309
1339
|
|
1310
1340
|
### Update/add locales
|
@@ -1368,7 +1398,7 @@ Fix lib/faker/version.rb
|
|
1368
1398
|
|
1369
1399
|
### Documentation
|
1370
1400
|
- [PR #1478](https://github.com/stympy/faker/pull/1478) Fixed documentation for Faker::Internet.password [@mrstebo](https://github.com/mrstebo)
|
1371
|
-
- [PR #1453](https://github.com/stympy/faker/pull/1453) Add description to
|
1401
|
+
- [PR #1453](https://github.com/stympy/faker/pull/1453) Add description to RuboCop cops [@vbrazo](https://github.com/vbrazo)
|
1372
1402
|
- [PR #1121](https://github.com/stympy/faker/pull/1121) Better docs for Faker::Food.description [@jujulisan](https://github.com/jujulisan)
|
1373
1403
|
- [PR #1257](https://github.com/stympy/faker/pull/1257) Fix method name in Faker::SingularSiegler [@mrstebo](https://github.com/mrstebo)
|
1374
1404
|
- [PR #1256](https://github.com/stympy/faker/pull/1256) Fixing documentation - Faker::Name to Faker::Zelda [@mrstebo](https://github.com/mrstebo)
|
data/README.md
CHANGED
@@ -285,6 +285,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
285
285
|
### Music
|
286
286
|
- [Faker::Music](doc/music/music.md)
|
287
287
|
- [Faker::Music::GratefulDead](doc/music/grateful_dead.md)
|
288
|
+
- [Faker::Music::HipHop](doc/music/hiphop.md)
|
288
289
|
- [Faker::Music::Opera](doc/music/opera.md)
|
289
290
|
- [Faker::Music::PearlJam](doc/music/pearl_jam.md)
|
290
291
|
- [Faker::Music::Phish](doc/music/phish.md)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'openssl'
|
4
4
|
require 'securerandom'
|
5
5
|
|
6
6
|
module Faker
|
@@ -51,7 +51,7 @@ module Faker
|
|
51
51
|
def address_for(network)
|
52
52
|
version = PROTOCOL_VERSIONS.fetch(network)
|
53
53
|
packed = version.chr + Faker::Config.random.bytes(20)
|
54
|
-
checksum = Digest::
|
54
|
+
checksum = OpenSSL::Digest::SHA256.digest(OpenSSL::Digest::SHA256.digest(packed))[0..3]
|
55
55
|
Faker::Base58.encode(packed + checksum)
|
56
56
|
end
|
57
57
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'openssl'
|
4
4
|
require 'securerandom'
|
5
5
|
|
6
6
|
module Faker
|
@@ -126,7 +126,7 @@ module Faker
|
|
126
126
|
def encode_tz(prefix, payload_size)
|
127
127
|
prefix = PREFIXES.fetch(prefix)
|
128
128
|
packed = prefix.map(&:chr).join('') + Faker::Config.random.bytes(payload_size)
|
129
|
-
checksum = Digest::
|
129
|
+
checksum = OpenSSL::Digest::SHA256.digest(OpenSSL::Digest::SHA256.digest(packed))[0..3]
|
130
130
|
Faker::Base58.encode(packed + checksum)
|
131
131
|
end
|
132
132
|
end
|
data/lib/faker/default/bank.rb
CHANGED
@@ -31,12 +31,13 @@ module Faker
|
|
31
31
|
##
|
32
32
|
# Produces a bank iban number.
|
33
33
|
#
|
34
|
-
# @param country_code [String] Specifies what country prefix is used to generate the iban code.
|
34
|
+
# @param country_code [String, nil] Specifies what country prefix is used to generate the iban code. Providing `nil` will use a random country.
|
35
35
|
# @return [String]
|
36
36
|
#
|
37
37
|
# @example
|
38
38
|
# Faker::Bank.iban #=> "GB76DZJM33188515981979"
|
39
39
|
# Faker::Bank.iban(country_code: "be") #=> "BE6375388567752043"
|
40
|
+
# Faker::Bank.iban(country_code: nil) #=> "DE45186738071857270067"
|
40
41
|
#
|
41
42
|
# @faker.version 1.7.0
|
42
43
|
def iban(legacy_country_code = NOT_GIVEN, country_code: 'GB')
|
@@ -47,6 +48,8 @@ module Faker
|
|
47
48
|
keywords << :country_code if legacy_country_code != NOT_GIVEN
|
48
49
|
end
|
49
50
|
|
51
|
+
country_code ||= iban_country_code
|
52
|
+
|
50
53
|
begin
|
51
54
|
pattern = fetch("bank.iban_details.#{country_code.downcase}.bban_pattern")
|
52
55
|
rescue I18n::MissingTranslationData
|
@@ -60,6 +63,19 @@ module Faker
|
|
60
63
|
country_code.upcase + iban_checksum(country_code, account) + account
|
61
64
|
end
|
62
65
|
|
66
|
+
##
|
67
|
+
# Produces the ISO 3166 code of a country that uses the IBAN system.
|
68
|
+
#
|
69
|
+
# @return [String]
|
70
|
+
#
|
71
|
+
# @example
|
72
|
+
# Faker::Bank.iban_country_code #=> "CH"
|
73
|
+
#
|
74
|
+
# @faker.version next
|
75
|
+
def iban_country_code
|
76
|
+
sample(translate('faker.bank.iban_details').keys).to_s.upcase
|
77
|
+
end
|
78
|
+
|
63
79
|
##
|
64
80
|
# Produces a bank name.
|
65
81
|
#
|
data/lib/faker/default/crypto.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'openssl'
|
4
4
|
|
5
5
|
module Faker
|
6
6
|
class Crypto < Base
|
@@ -15,7 +15,7 @@ module Faker
|
|
15
15
|
#
|
16
16
|
# @faker.version 1.6.4
|
17
17
|
def md5
|
18
|
-
Digest::MD5.hexdigest(Lorem.characters)
|
18
|
+
OpenSSL::Digest::MD5.hexdigest(Lorem.characters)
|
19
19
|
end
|
20
20
|
|
21
21
|
##
|
@@ -28,7 +28,7 @@ module Faker
|
|
28
28
|
#
|
29
29
|
# @faker.version 1.6.4
|
30
30
|
def sha1
|
31
|
-
Digest::SHA1.hexdigest(Lorem.characters)
|
31
|
+
OpenSSL::Digest::SHA1.hexdigest(Lorem.characters)
|
32
32
|
end
|
33
33
|
|
34
34
|
##
|
@@ -41,7 +41,7 @@ module Faker
|
|
41
41
|
#
|
42
42
|
# @faker.version 1.6.4
|
43
43
|
def sha256
|
44
|
-
Digest::SHA256.hexdigest(Lorem.characters)
|
44
|
+
OpenSSL::Digest::SHA256.hexdigest(Lorem.characters)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -72,6 +72,19 @@ module Faker
|
|
72
72
|
parse('educator.secondary_school')
|
73
73
|
end
|
74
74
|
|
75
|
+
##
|
76
|
+
# Produces a primary school.
|
77
|
+
#
|
78
|
+
# @return [String]
|
79
|
+
#
|
80
|
+
# @example
|
81
|
+
# Faker::Educator.primary_school #=> "Brighthurst Elementary School"
|
82
|
+
#
|
83
|
+
# @faker.version next
|
84
|
+
def primary_school
|
85
|
+
parse('educator.primary_school')
|
86
|
+
end
|
87
|
+
|
75
88
|
##
|
76
89
|
# Produces a campus name.
|
77
90
|
#
|
data/lib/faker/default/number.rb
CHANGED
@@ -139,11 +139,26 @@ module Faker
|
|
139
139
|
hex
|
140
140
|
end
|
141
141
|
|
142
|
+
# Produces a number in binary format.
|
143
|
+
#
|
144
|
+
# @param digits [Integer] Number of digits to generate the binary as string
|
145
|
+
# @return [String]
|
146
|
+
#
|
147
|
+
# @example
|
148
|
+
# Faker::Number.binary(digits: 4) #=> "1001"
|
149
|
+
#
|
150
|
+
# @faker.version next
|
151
|
+
def binary(digits: 4)
|
152
|
+
bin = ''
|
153
|
+
digits.times { bin += rand(2).to_s(2) }
|
154
|
+
bin
|
155
|
+
end
|
156
|
+
|
142
157
|
##
|
143
158
|
# Produces a float given a mean and standard deviation.
|
144
159
|
#
|
145
160
|
# @param mean [Integer]
|
146
|
-
# @param standard_deviation [
|
161
|
+
# @param standard_deviation [Numeric]
|
147
162
|
# @return [Float]
|
148
163
|
#
|
149
164
|
# @example
|
@@ -165,12 +180,13 @@ module Faker
|
|
165
180
|
##
|
166
181
|
# Produces a number between two provided values. Boundaries are inclusive.
|
167
182
|
#
|
168
|
-
# @param from [
|
169
|
-
# @param to [
|
170
|
-
# @return [
|
183
|
+
# @param from [Numeric] The lowest number to include.
|
184
|
+
# @param to [Numeric] The highest number to include.
|
185
|
+
# @return [Numeric]
|
171
186
|
#
|
172
187
|
# @example
|
173
188
|
# Faker::Number.between(from: 1, to: 10) #=> 7
|
189
|
+
# Faker::Number.between(from: 0.0, to: 1.0) #=> 0.7844640543957383
|
174
190
|
#
|
175
191
|
# @faker.version 1.0.0
|
176
192
|
def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 1.00, to: 5000.00)
|
@@ -186,10 +202,11 @@ module Faker
|
|
186
202
|
# Produces a number within two provided values. Boundaries are inclusive or exclusive depending on the range passed.
|
187
203
|
#
|
188
204
|
# @param range [Range] The range from which to generate a number.
|
189
|
-
# @return [
|
205
|
+
# @return [Numeric]
|
190
206
|
#
|
191
207
|
# @example
|
192
208
|
# Faker::Number.within(range: 1..10) #=> 7
|
209
|
+
# Faker::Number.within(range: 0.0..1.0) #=> 0.7844640543957383
|
193
210
|
#
|
194
211
|
# @faker.version 1.0.0
|
195
212
|
def within(legacy_range = NOT_GIVEN, range: 1.00..5000.00)
|
data/lib/faker/default/types.rb
CHANGED
@@ -72,7 +72,7 @@ module Faker
|
|
72
72
|
# Faker::Types.rb_hash(number: 2) #=> {name: "bob", last: "marley"}
|
73
73
|
#
|
74
74
|
# @faker.version 1.8.6
|
75
|
-
def rb_hash(legacy_number = NOT_GIVEN, legacy_type = NOT_GIVEN, number: 1, type: random_type)
|
75
|
+
def rb_hash(legacy_number = NOT_GIVEN, legacy_type = NOT_GIVEN, number: 1, type: -> { random_type })
|
76
76
|
warn_for_deprecated_arguments do |keywords|
|
77
77
|
keywords << :number if legacy_number != NOT_GIVEN
|
78
78
|
keywords << :type if legacy_type != NOT_GIVEN
|
@@ -80,7 +80,8 @@ module Faker
|
|
80
80
|
|
81
81
|
{}.tap do |hsh|
|
82
82
|
Lorem.words(number: number * 2).uniq.first(number).each do |s|
|
83
|
-
|
83
|
+
value = type.is_a?(Proc) ? type.call : type
|
84
|
+
hsh.merge!(s.to_sym => value)
|
84
85
|
end
|
85
86
|
end
|
86
87
|
end
|
@@ -102,7 +103,7 @@ module Faker
|
|
102
103
|
keywords << :number if legacy_number != NOT_GIVEN
|
103
104
|
end
|
104
105
|
|
105
|
-
rb_hash(number: number, type: random_complex_type)
|
106
|
+
rb_hash(number: number, type: -> { random_complex_type })
|
106
107
|
end
|
107
108
|
|
108
109
|
##
|
data/lib/faker/version.rb
CHANGED
@@ -14,7 +14,6 @@ module Faker
|
|
14
14
|
@previous_results = Hash.new { |hash, key| hash[key] = Set.new }
|
15
15
|
end
|
16
16
|
|
17
|
-
# rubocop:disable Lint/MissingSuper
|
18
17
|
def method_missing(name, *arguments)
|
19
18
|
self.class.marked_unique.add(self)
|
20
19
|
|
@@ -29,8 +28,6 @@ module Faker
|
|
29
28
|
|
30
29
|
raise RetryLimitExceeded, "Retry limit exceeded for #{name}"
|
31
30
|
end
|
32
|
-
# rubocop:enable Lint/MissingSuper
|
33
|
-
|
34
31
|
# Have method_missing use ruby 2.x keywords if the method exists.
|
35
32
|
# This is necessary because the syntax for passing arguments (`...`)
|
36
33
|
# is invalid on versions before Ruby 2.7, so it can't be used.
|