faker 2.1.2 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +88 -7
- data/README.md +2 -3
- data/lib/faker.rb +56 -1
- data/lib/faker/blockchain/bitcoin.rb +26 -0
- data/lib/faker/blockchain/ethereum.rb +10 -0
- data/lib/faker/blockchain/tezos.rb +62 -6
- data/lib/faker/books/book.rb +36 -0
- data/lib/faker/books/culture_series.rb +49 -0
- data/lib/faker/books/dune.rb +66 -5
- data/lib/faker/books/lovecraft.rb +210 -7
- data/lib/faker/creature/animal.rb +9 -0
- data/lib/faker/creature/cat.rb +27 -0
- data/lib/faker/creature/dog.rb +72 -0
- data/lib/faker/creature/horse.rb +18 -0
- data/lib/faker/default/address.rb +25 -5
- data/lib/faker/default/alphanumeric.rb +56 -7
- data/lib/faker/default/app.rb +54 -1
- data/lib/faker/default/artist.rb +9 -0
- data/lib/faker/default/avatar.rb +42 -1
- data/lib/faker/default/bank.rb +10 -2
- data/lib/faker/default/boolean.rb +16 -1
- data/lib/faker/default/chile_rut.rb +12 -2
- data/lib/faker/default/code.rb +16 -3
- data/lib/faker/default/commerce.rb +17 -3
- data/lib/faker/default/company.rb +10 -2
- data/lib/faker/default/crypto_coin.rb +15 -3
- data/lib/faker/default/date.rb +37 -5
- data/lib/faker/default/demographic.rb +5 -1
- data/lib/faker/default/driving_licence.rb +10 -4
- data/lib/faker/default/file.rb +19 -2
- data/lib/faker/default/fillmurray.rb +9 -1
- data/lib/faker/default/finance.rb +5 -1
- data/lib/faker/default/gender.rb +18 -0
- data/lib/faker/default/hacker.rb +59 -1
- data/lib/faker/default/hipster.rb +45 -6
- data/lib/faker/default/house.rb +18 -0
- data/lib/faker/default/id_number.rb +11 -3
- data/lib/faker/default/internet.rb +94 -13
- data/lib/faker/default/invoice.rb +16 -3
- data/lib/faker/default/json.rb +19 -2
- data/lib/faker/default/lorem.rb +81 -10
- data/lib/faker/default/lorem_flickr.rb +38 -5
- data/lib/faker/default/lorem_pixel.rb +10 -1
- data/lib/faker/default/markdown.rb +6 -1
- data/lib/faker/default/measurement.rb +40 -8
- data/lib/faker/default/name.rb +5 -1
- data/lib/faker/default/nhs.rb +5 -1
- data/lib/faker/default/number.rb +56 -11
- data/lib/faker/default/omniauth.rb +92 -9
- data/lib/faker/default/phone_number.rb +5 -1
- data/lib/faker/default/placeholdit.rb +11 -1
- data/lib/faker/default/programming_language.rb +18 -0
- data/lib/faker/default/relationship.rb +5 -1
- data/lib/faker/default/source.rb +59 -3
- data/lib/faker/default/string.rb +5 -1
- data/lib/faker/default/stripe.rb +20 -4
- data/lib/faker/default/time.rb +37 -4
- data/lib/faker/default/twitter.rb +32 -18
- data/lib/faker/default/types.rb +27 -5
- data/lib/faker/default/vehicle.rb +17 -4
- data/lib/faker/default/world_cup.rb +11 -2
- data/lib/faker/games/dota.rb +5 -1
- data/lib/faker/games/elder_scrolls.rb +72 -0
- data/lib/faker/games/fallout.rb +37 -0
- data/lib/faker/games/game.rb +27 -0
- data/lib/faker/games/half_life.rb +27 -0
- data/lib/faker/games/overwatch.rb +27 -0
- data/lib/faker/games/super_smash_bros.rb +18 -0
- data/lib/faker/games/zelda.rb +36 -0
- data/lib/faker/movies/star_wars.rb +6 -4
- data/lib/faker/tv_shows/breaking_bad.rb +18 -0
- data/lib/faker/version.rb +1 -1
- data/lib/locales/en-CA.yml +1 -1
- data/lib/locales/en/science.yml +1 -1
- data/lib/locales/ja.yml +1 -1
- metadata +31 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bec55e97c49aba2834c60f979ddfbbba32d561b6300640059e10b74f4f64a11
|
4
|
+
data.tar.gz: 60197e5cfab12ef29607bfb817a86fb14db6757d3868afbc5dd2a2751412e070
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6163f75344392f843e01d14ff8ddb484c40ad7b8b055a1e7a3be1cfebb972b5e5244ac4f61b424862d997bee39c4d3b61d1b605aebad6f6534e771acb32ca380
|
7
|
+
data.tar.gz: 93310c967dc3daa9a664d456978a636b7bc01122fbbe4a1c565206db401bfcdadee214d01c0e4b2b22be4c001cdf255de5f46762df2cb16d9f4e5fcb2c006418
|
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,93 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [v2.
|
3
|
+
## [v2.3.0](https://github.com/faker-ruby/faker/tree/v2.3.0) (2019-12-09)
|
4
|
+
|
5
|
+
## Documentation
|
6
|
+
|
7
|
+
- [PR #1741](https://github.com/faker-ruby/faker/pull/1741) Fix the .gitignore for YARD. [@connorshea](https://github.com/connorshea)
|
8
|
+
- [PR #1553](https://github.com/faker-ruby/faker/pull/1553) Yard powered docs [@Zeragamba](https://github.com/Zeragamba) [@connorshea](https://github.com/connorshea)
|
9
|
+
- [PR #1727](https://github.com/faker-ruby/faker/pull/1727) Remove Football documentation from wrong category [@lucasqueiroz](https://github.com/lucasqueiroz)
|
10
|
+
|
11
|
+
## Feature Request
|
12
|
+
|
13
|
+
- [PR #1738](https://github.com/faker-ruby/faker/pull/1738) Add mock data for Apple OAuth [@dzunk](https://github.com/dzunk)
|
14
|
+
|
15
|
+
## Update locales
|
16
|
+
|
17
|
+
- [PR #1732](https://github.com/faker-ruby/faker/pull/1732) Add pokemon name in Johto area [@mathieujobin](https://github.com/mathieujobin)
|
18
|
+
- [PR #1723](https://github.com/faker-ruby/faker/pull/1723) Quebec province postal codes starts by [GHJ], adding missing two [@Ryutooooo](https://github.com/Ryutooooo)
|
19
|
+
|
20
|
+
------------------------------------------------------------------------------
|
21
|
+
|
22
|
+
## [v2.2.2](https://github.com/faker-ruby/faker/tree/v2.2.2) (2019-05-09)
|
23
|
+
|
24
|
+
## Bug/Fixes
|
25
|
+
|
26
|
+
- [PR #1717](https://github.com/faker-ruby/faker/pull/1717) Fix ambiguity in element_symbol field [@psibi](https://github.com/psibi)
|
27
|
+
|
28
|
+
## Chores
|
29
|
+
|
30
|
+
- [PR #1724](https://github.com/faker-ruby/faker/pull/1724) Include rubocop-faker autocorrect in deprecation [@koic](https://github.com/koic)
|
31
|
+
|
32
|
+
## Documentation
|
33
|
+
|
34
|
+
- [PR #1726](https://github.com/faker-ruby/faker/pull/1726) Include 2.x breaking return value change in changelog [@zorab47](https://github.com/zorab47)
|
35
|
+
- [PR #1722](https://github.com/faker-ruby/faker/pull/1722) Fix examples in the Dota docs [@bzf](https://github.com/bzf)
|
36
|
+
|
37
|
+
## Update local dependencies
|
38
|
+
|
39
|
+
The following development dependencies were updated:
|
40
|
+
- rake requirement from = 12.3.1 to = 12.3.3 (#1719)
|
41
|
+
- rubocop requirement from = 0.59.1 to = 0.74.0 (#1721)
|
42
|
+
- simplecov requirement from = 0.16.1 to = 0.17.0 (#1718)
|
43
|
+
|
44
|
+
------------------------------------------------------------------------------
|
45
|
+
|
46
|
+
## [v2.2.1](https://github.com/faker-ruby/faker/tree/v2.2.1) (2019-30-08)
|
47
|
+
|
48
|
+
## Bug/Fixes
|
49
|
+
|
50
|
+
- [PR #1712](https://github.com/faker-ruby/faker/pull/1712) Fix number(digits: 1) always returns 0 [@ianlet](https://github.com/ianlet)
|
51
|
+
|
52
|
+
`Faker::Number.number(digits: 1)` was always returning `0`.
|
53
|
+
|
54
|
+
Fixing number with one digit caused the test_insignificant_zero to fail. As it seemed that the behavior tested by test_insignificant_zero was already covered by test_number and test_decimal, we removed it to prevent duplication.
|
55
|
+
|
56
|
+
## [v2.2.0](https://github.com/faker-ruby/faker/tree/v2.2.0) (2019-25-08)
|
57
|
+
|
58
|
+
## Deprecate
|
59
|
+
|
60
|
+
- [PR #1698](https://github.com/faker-ruby/faker/pull/1698) Add warn for positional arguments when using Faker 2.0 [@koic](https://github.com/koic)
|
61
|
+
|
62
|
+
Add deprecation warning for positional arguments to notify users that are coming from Faker version < 2.0. Its main goal is to make upgrades easier.
|
63
|
+
|
64
|
+
## Documentation
|
65
|
+
|
66
|
+
- [PR #1688](https://github.com/faker-ruby/faker/pull/1688) Update README install instructions [@EduardoGHdez](https://github.com/EduardoGHdez)
|
67
|
+
- [PR #1689](https://github.com/faker-ruby/faker/pull/1689) Update README.md [@Zeragamba](https://github.com/Zeragamba)
|
68
|
+
- [PR #1690](https://github.com/faker-ruby/faker/pull/1690) Update issue url in PULL_REQUEST_TEMPLATE [@bugtender](https://github.com/bugtender)
|
69
|
+
- [PR #1703](https://github.com/faker-ruby/faker/pull/1703) Return HTTPS URLs from Lorem Flickr [@connorshea](https://github.com/connorshea)
|
70
|
+
|
71
|
+
## Feature Request
|
72
|
+
- [PR #1686](https://github.com/faker-ruby/faker/pull/1686) Update test-unit gem to 3.3.3 [@connorshea](https://github.com/connorshea)
|
73
|
+
|
74
|
+
## Bug/Fixes
|
75
|
+
- [PR #1702](https://github.com/faker-ruby/faker/pull/1702) Fix an argument for test_faker_stripe.rb [@koic](https://github.com/koic)
|
76
|
+
- [PR #1694](https://github.com/faker-ruby/faker/pull/1694) Ensure mix_case returns at least one lower and one upper case letter [@bpleslie](https://github.com/bpleslie)
|
77
|
+
|
78
|
+
------------------------------------------------------------------------------
|
79
|
+
|
80
|
+
## [v2.1.2](https://github.com/faker-ruby/faker/tree/v2.1.2) (2019-10-08)
|
4
81
|
|
5
82
|
## Enhancements
|
6
83
|
|
7
|
-
- [PR #1495](https://github.com/
|
84
|
+
- [PR #1495](https://github.com/faker-ruby/faker/pull/1495) Add Brazilian documents generation and documentation [@lucasqueiroz](https://github.com/lucasqueiroz)
|
8
85
|
|
9
86
|
## Issues
|
10
87
|
|
11
88
|
We had to use `bundled with 1.7.3` to avoid some issues.
|
12
89
|
|
13
|
-
## [v2.1.1](https://github.com/
|
90
|
+
## [v2.1.1](https://github.com/faker-ruby/faker/tree/2.1.1) (2019-10-08)
|
14
91
|
|
15
92
|
## Bug/Fixes
|
16
93
|
|
@@ -24,20 +101,20 @@ Rollback Faker::Time changes because we should expect the date format from activ
|
|
24
101
|
|
25
102
|
## Documentation
|
26
103
|
|
27
|
-
- [PR #1677](https://github.com/
|
104
|
+
- [PR #1677](https://github.com/faker-ruby/faker/pull/1677) Fix docs for Internet#password generator [@ur5us](https://github.com/ur5us)
|
28
105
|
|
29
106
|
------------------------------------------------------------------------------
|
30
107
|
|
31
|
-
## [v2.1.0](https://github.com/
|
108
|
+
## [v2.1.0](https://github.com/faker-ruby/faker/tree/v2.1.0) (2019-31-07)
|
32
109
|
|
33
110
|
## Bug/Fixes
|
34
|
-
- [PR #1675](https://github.com/
|
111
|
+
- [PR #1675](https://github.com/faker-ruby/faker/pull/1675) Fix off-by-one error when formatting month names [@jutonz](https://github.com/jutonz)
|
35
112
|
|
36
113
|
This change required a quick release because it's a breaking issue. Every place where I18n.l() was used began to display the wrong date, causing test suite to fail.
|
37
114
|
|
38
115
|
------------------------------------------------------------------------------
|
39
116
|
|
40
|
-
## [v2.0](https://github.com/
|
117
|
+
## [v2.0](https://github.com/faker-ruby/faker/tree/v2.0) (2019-31-07)
|
41
118
|
|
42
119
|
## Important Note:
|
43
120
|
|
@@ -168,6 +245,10 @@ Version 2 has several `breaking changes`. We replaced positional arguments with
|
|
168
245
|
- `Faker::WorldCup.roster(country = nil, type = nil)` becomes `Faker::WorldCup.roster(country: nil, type: nil)`
|
169
246
|
- `Faker::Movies::StarWars.quote(character = nil)` becomes `Faker::Movies::StarWars.quote(character: nil)`
|
170
247
|
|
248
|
+
Additionally the following methods changed return values:
|
249
|
+
|
250
|
+
- `Faker::Number.number` now returns `Numeric` instead of `String` (see [PR #510](https://github.com/faker-ruby/faker/pull/510))
|
251
|
+
|
171
252
|
### Bug/Fixes
|
172
253
|
|
173
254
|
- [PR #1660](https://github.com/stympy/faker/pull/1660) Update FillMurray Links To Include www [@RaymondFallon](https://github.com/RaymondFallon)
|
data/README.md
CHANGED
@@ -55,7 +55,7 @@ gem install faker
|
|
55
55
|
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:
|
56
56
|
|
57
57
|
```ruby
|
58
|
-
gem 'faker', :git => 'https://github.com/
|
58
|
+
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'master'
|
59
59
|
```
|
60
60
|
|
61
61
|
## Usage
|
@@ -117,7 +117,7 @@ Faker::Company.bs #=> "cultivate viral synergies"
|
|
117
117
|
**NOTE: Some of the generators below aren't released yet. If you want to use them, change the line in your gemfile to:**
|
118
118
|
|
119
119
|
```ruby
|
120
|
-
gem 'faker', :git => 'https://github.com/
|
120
|
+
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'master'
|
121
121
|
```
|
122
122
|
|
123
123
|
### Default
|
@@ -161,7 +161,6 @@ gem 'faker', :git => 'https://github.com/stympy/faker.git', :branch => 'master'
|
|
161
161
|
- [Faker::Fillmurray](doc/default/fillmurray.md)
|
162
162
|
- [Faker::Finance](doc/default/finance.md)
|
163
163
|
- [Faker::Food](doc/default/food.md)
|
164
|
-
- [Faker::Football](doc/default/football.md)
|
165
164
|
- [Faker::FunnyName](doc/default/funny_name.md)
|
166
165
|
- [Faker::Gender](doc/default/gender.md)
|
167
166
|
- [Faker::GreekPhilosophers](doc/default/greek_philosophers.md)
|
data/lib/faker.rb
CHANGED
@@ -40,9 +40,12 @@ module Faker
|
|
40
40
|
class Base
|
41
41
|
Numbers = Array(0..9)
|
42
42
|
ULetters = Array('A'..'Z')
|
43
|
-
|
43
|
+
LLetters = Array('a'..'z')
|
44
|
+
Letters = ULetters + LLetters
|
44
45
|
|
45
46
|
class << self
|
47
|
+
NOT_GIVEN = Object.new
|
48
|
+
|
46
49
|
## by default numerify results do not start with a zero
|
47
50
|
def numerify(number_string, leading_zero: false)
|
48
51
|
return number_string.gsub(/#/) { rand(10).to_s } if leading_zero
|
@@ -245,6 +248,58 @@ module Faker
|
|
245
248
|
ensure
|
246
249
|
I18n.enforce_available_locales = old_enforce_available_locales
|
247
250
|
end
|
251
|
+
|
252
|
+
private
|
253
|
+
|
254
|
+
def warn_for_deprecated_arguments
|
255
|
+
keywords = []
|
256
|
+
yield(keywords)
|
257
|
+
|
258
|
+
return if keywords.empty?
|
259
|
+
|
260
|
+
method_name = caller.first.match(/`(?<method_name>.*)'/)[:method_name]
|
261
|
+
|
262
|
+
keywords.each.with_index(1) do |keyword, index|
|
263
|
+
i = case index
|
264
|
+
when 1 then '1st'
|
265
|
+
when 2 then '2nd'
|
266
|
+
when 3 then '3rd'
|
267
|
+
else "#{index}th"
|
268
|
+
end
|
269
|
+
|
270
|
+
warn_with_uplevel(<<~MSG, uplevel: 5)
|
271
|
+
Passing `#{keyword}` with the #{i} argument of `#{method_name}` is deprecated. Use keyword argument like `#{method_name}(#{keyword}: ...)` instead.
|
272
|
+
MSG
|
273
|
+
end
|
274
|
+
|
275
|
+
warn(<<~MSG)
|
276
|
+
|
277
|
+
To automatically update from positional arguments to keyword arguments,
|
278
|
+
install rubocop-faker and run:
|
279
|
+
|
280
|
+
rubocop \\
|
281
|
+
--require rubocop-faker \\
|
282
|
+
--only Faker/DeprecatedArguments \\
|
283
|
+
--auto-correct
|
284
|
+
|
285
|
+
MSG
|
286
|
+
end
|
287
|
+
|
288
|
+
# Workaround for emulating `warn '...', uplevel: 1` in Ruby 2.4 or lower.
|
289
|
+
def warn_with_uplevel(message, uplevel: 1)
|
290
|
+
at = parse_caller(caller[uplevel]).join(':')
|
291
|
+
warn "#{at}: #{message}"
|
292
|
+
end
|
293
|
+
|
294
|
+
def parse_caller(at)
|
295
|
+
# rubocop:disable Style/GuardClause
|
296
|
+
if /^(.+?):(\d+)(?::in `.*')?/ =~ at
|
297
|
+
file = Regexp.last_match(1)
|
298
|
+
line = Regexp.last_match(2).to_i
|
299
|
+
[file, line]
|
300
|
+
end
|
301
|
+
# rubocop:enable Style/GuardClause
|
302
|
+
end
|
248
303
|
end
|
249
304
|
end
|
250
305
|
end
|
@@ -7,21 +7,47 @@ module Faker
|
|
7
7
|
class Blockchain
|
8
8
|
class Bitcoin < Base
|
9
9
|
class << self
|
10
|
+
# @private
|
10
11
|
PROTOCOL_VERSIONS = {
|
11
12
|
main: 0,
|
12
13
|
testnet: 111
|
13
14
|
}.freeze
|
14
15
|
|
16
|
+
##
|
17
|
+
# Produces a Bitcoin wallet address
|
18
|
+
#
|
19
|
+
# @return [String]
|
20
|
+
#
|
21
|
+
# @example
|
22
|
+
# Faker::Blockchain::Bitcoin.address
|
23
|
+
# #=> "147nDP22h3pHrLt2qykTH4txUwQh1ccaXp"
|
24
|
+
#
|
25
|
+
# @faker.version 1.9.2
|
15
26
|
def address
|
16
27
|
address_for(:main)
|
17
28
|
end
|
18
29
|
|
30
|
+
##
|
31
|
+
# Produces a Bitcoin testnet address
|
32
|
+
#
|
33
|
+
# @return [String]
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# Faker::Blockchain::Bitcoin.testnet_address
|
37
|
+
# #=> "n4YjRyYD6V6zREpk6opqESDqD3KYnMdVEB"
|
38
|
+
#
|
39
|
+
# @faker.version 1.9.2
|
19
40
|
def testnet_address
|
20
41
|
address_for(:testnet)
|
21
42
|
end
|
22
43
|
|
23
44
|
protected
|
24
45
|
|
46
|
+
##
|
47
|
+
# Generates a random Bitcoin address for the given network
|
48
|
+
#
|
49
|
+
# @param network [Symbol] The name of network protocol to generate an address for
|
50
|
+
# @return [String] A Bitcoin address
|
25
51
|
def address_for(network)
|
26
52
|
version = PROTOCOL_VERSIONS.fetch(network)
|
27
53
|
packed = version.chr + Faker::Config.random.bytes(20)
|
@@ -4,6 +4,16 @@ module Faker
|
|
4
4
|
class Blockchain
|
5
5
|
class Ethereum < Base
|
6
6
|
class << self
|
7
|
+
##
|
8
|
+
# Produces a random Ethereum wallet address
|
9
|
+
#
|
10
|
+
# @return [String]
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# Faker::Blockchain::Ethereum.address
|
14
|
+
# #=> "0xd392b0c0500700d02d27ab30805ec80ddd3320ff"
|
15
|
+
#
|
16
|
+
# @faker.version 1.9.1
|
7
17
|
def address
|
8
18
|
hex_alphabet = '0123456789abcdef'
|
9
19
|
var = +'0x'
|
@@ -7,38 +7,94 @@ module Faker
|
|
7
7
|
class Blockchain
|
8
8
|
class Tezos < Base
|
9
9
|
class << self
|
10
|
+
# @private
|
10
11
|
PREFIXES = {
|
11
|
-
tz1:
|
12
|
-
KT1:
|
13
|
-
edpk:
|
14
|
-
edsk:
|
12
|
+
tz1: [6, 161, 159],
|
13
|
+
KT1: [2, 90, 121],
|
14
|
+
edpk: [13, 15, 37, 217],
|
15
|
+
edsk: [13, 15, 58, 7],
|
15
16
|
edsig: [9, 245, 205, 134, 18],
|
16
|
-
B:
|
17
|
-
o:
|
17
|
+
B: [1, 52],
|
18
|
+
o: [5, 116]
|
18
19
|
}.freeze
|
19
20
|
|
21
|
+
##
|
22
|
+
# Produces a random Tezos account address
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# Faker::Blockchain::Tezos.account
|
28
|
+
# #=> "tz1eUsgK6aj752Fbxwk5sAoEFvSDnPjZ4qvk"
|
29
|
+
#
|
30
|
+
# @faker.version 1.9.2
|
20
31
|
def account
|
21
32
|
encode_tz(:tz1, 20)
|
22
33
|
end
|
23
34
|
|
35
|
+
##
|
36
|
+
# Produces a random Tezos contract
|
37
|
+
#
|
38
|
+
# @return [String]
|
39
|
+
#
|
40
|
+
# @example
|
41
|
+
# Faker::Blockchain::Tezos.contract
|
42
|
+
# #=> "KT1MroqeP15nnitB4CnNfkqHYa2NErhPPLWF"
|
43
|
+
#
|
44
|
+
# @faker.version 1.9.2
|
24
45
|
def contract
|
25
46
|
encode_tz(:KT1, 20)
|
26
47
|
end
|
27
48
|
|
49
|
+
##
|
50
|
+
# Produces a random Tezos operation
|
51
|
+
#
|
52
|
+
# @return [String]
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
# Faker::Blockchain::Tezos.operation
|
56
|
+
# #=> "onygWYXJX3xNstFLv9PcCrhQdCkENC795xwSinmTEc1jsDN4VDa"
|
57
|
+
#
|
58
|
+
# @faker.version 1.9.2
|
28
59
|
def operation
|
29
60
|
encode_tz(:o, 32)
|
30
61
|
end
|
31
62
|
|
63
|
+
##
|
64
|
+
# Produces a random Tezos block
|
65
|
+
#
|
66
|
+
# @return [String]
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
# Faker::Blockchain::Tezos.block
|
70
|
+
# #=> "BMbhs2rkY1dvAkAyRytvPsjFQ2RiPrBhYkxvWpY65dzkdSuw58a"
|
71
|
+
#
|
72
|
+
# @faker.version 1.9.4
|
32
73
|
def block
|
33
74
|
encode_tz(:B, 32)
|
34
75
|
end
|
35
76
|
|
77
|
+
##
|
78
|
+
# Produces a random Tezos signature
|
79
|
+
#
|
80
|
+
# @return [String]
|
81
|
+
#
|
82
|
+
# @example
|
83
|
+
# Faker::Blockchain::Tezos.signature
|
84
|
+
# #=> "edsigu165B7VFf3Dpw2QABVzEtCxJY2gsNBNcE3Ti7rRxtDUjqTFRpg67EdAQmY6YWPE5tKJDMnSTJDFu65gic8uLjbW2YwGvAZ"
|
85
|
+
#
|
86
|
+
# @faker.version 1.9.2
|
36
87
|
def signature
|
37
88
|
encode_tz(:edsig, 64)
|
38
89
|
end
|
39
90
|
|
40
91
|
protected
|
41
92
|
|
93
|
+
##
|
94
|
+
# @param prefix [Symbol]
|
95
|
+
# @param payload_size [Integer] The size of the payload
|
96
|
+
#
|
97
|
+
# @return [String]
|
42
98
|
def encode_tz(prefix, payload_size)
|
43
99
|
prefix = PREFIXES.fetch(prefix)
|
44
100
|
packed = prefix.map(&:chr).join('') + Faker::Config.random.bytes(payload_size)
|
data/lib/faker/books/book.rb
CHANGED
@@ -5,18 +5,54 @@ module Faker
|
|
5
5
|
flexible :book
|
6
6
|
|
7
7
|
class << self
|
8
|
+
##
|
9
|
+
# Produces a random book title
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Faker::Book.title #=> "The Odd Sister"
|
15
|
+
#
|
16
|
+
# @faker.version 1.9.3
|
8
17
|
def title
|
9
18
|
fetch('book.title')
|
10
19
|
end
|
11
20
|
|
21
|
+
##
|
22
|
+
# Produces a random book author
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# Faker::Book.author #=> "Alysha Olsen"
|
28
|
+
#
|
29
|
+
# @faker.version 1.9.3
|
12
30
|
def author
|
13
31
|
parse('book.author')
|
14
32
|
end
|
15
33
|
|
34
|
+
##
|
35
|
+
# Produces a random book publisher
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# Faker::Book.publisher #=> "Opus Reader"
|
41
|
+
#
|
42
|
+
# @faker.version 1.9.3
|
16
43
|
def publisher
|
17
44
|
fetch('book.publisher')
|
18
45
|
end
|
19
46
|
|
47
|
+
##
|
48
|
+
# Produces a random genre
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
# Faker::Book.genre #=> "Mystery"
|
54
|
+
#
|
55
|
+
# @faker.version 1.9.3
|
20
56
|
def genre
|
21
57
|
fetch('book.genre')
|
22
58
|
end
|