faker 2.19.0 → 2.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -3
- data/lib/faker/books/the_kingkiller_chronicle.rb +61 -0
- data/lib/faker/default/company.rb +4 -6
- data/lib/faker/default/internet.rb +51 -16
- data/lib/faker/default/lorem.rb +0 -4
- data/lib/faker/default/nation.rb +0 -3
- data/lib/faker/default/omniauth.rb +45 -1
- data/lib/faker/default/religion.rb +6 -0
- data/lib/faker/default/string.rb +0 -3
- data/lib/faker/default/time.rb +0 -2
- data/lib/faker/japanese_media/fullmetal_alchemist_brotherhood.rb +48 -0
- data/lib/faker/japanese_media/kamen_rider.rb +102 -0
- data/lib/faker/religion/bible.rb +50 -0
- data/lib/faker/tv_shows/brooklyn_nine_nine.rb +38 -0
- data/lib/faker/tv_shows/michael_scott.rb +0 -3
- data/lib/faker/version.rb +1 -1
- data/lib/locales/ar.yml +5 -1
- data/lib/locales/de-AT.yml +2 -2
- data/lib/locales/en/address.yml +2 -3
- data/lib/locales/en/bible.yml +90 -0
- data/lib/locales/en/brooklyn_nine_nine.yml +35 -0
- data/lib/locales/en/cat.yml +1 -1
- data/lib/locales/en/coffee.yml +1 -1
- data/lib/locales/en/fma_brotherhood.yml +78 -0
- data/lib/locales/en/game.yml +12 -0
- data/lib/locales/en/internet.yml +108 -3
- data/lib/locales/en/kamen_rider.yml +452 -0
- data/lib/locales/en/mountain.yml +14 -1
- data/lib/locales/en/stranger_thing.yml +1 -1
- data/lib/locales/en/super_smash_bros.yml +2 -0
- data/lib/locales/en/the_kingkiller_chronicle.yml +56 -0
- data/lib/locales/en-US.yml +1 -1
- data/lib/locales/ja/address.yml +258 -4169
- data/lib/locales/ja/lorem.yml +2 -2
- data/lib/locales/ja/super_smash_bros.yml +8 -0
- data/lib/locales/lt.yml +35 -0
- data/lib/locales/lv.yml +1 -1
- data/lib/locales/mi-NZ.yml +281 -0
- data/lib/locales/pt-BR.yml +4 -0
- metadata +30 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 263e2d15636da915718fec1db63ac9595f87b2a075ddaa0e536ce89a57523b81
|
4
|
+
data.tar.gz: 677c2ee1537ece0e18820f72ac1a528c3581f60e298d51c125ff9d673d6e6022
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad45cb3518237236a31bf97d0bbe48214cef9ef1debca67f3d4ea5cb0c105c9d045d37fd22f33cc9da90be89ddb1ce8113d9a016f4f18098a679e5e9e53521d0
|
7
|
+
data.tar.gz: 449074010c194137d0f9bc77e4730f09058559016e780a4ca78c1bcb4f650002e22f8c6af0668f1f1d6ee43e25f11793855df496095ab0e314c8a24923daba29
|
data/README.md
CHANGED
@@ -136,6 +136,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
136
136
|
- [Faker::Boolean](doc/default/boolean.md)
|
137
137
|
- [Faker::BossaNova](doc/default/bossa_nova.md)
|
138
138
|
- [Faker::Business](doc/default/business.md)
|
139
|
+
- [Faker::Camera](doc/default/camera.md)
|
139
140
|
- [Faker::Cannabis](doc/default/cannabis.md)
|
140
141
|
- [Faker::ChileRut](doc/default/chile_rut.md)
|
141
142
|
- [Faker::ChuckNorris](doc/default/chuck_norris.md)
|
@@ -230,6 +231,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
230
231
|
- [Faker::Books::CultureSeries](doc/books/culture_series.md)
|
231
232
|
- [Faker::Books::Dune](doc/books/dune.md)
|
232
233
|
- [Faker::Books::Lovecraft](doc/books/lovecraft.md)
|
234
|
+
- [Faker::Books::TheKingkillerChronicle](doc/books/the_kingkiller_chronicle.md)
|
233
235
|
|
234
236
|
### Fantasy
|
235
237
|
- [Faker::Fantasy::Tolkien](doc/fantasy/tolkien.md)
|
@@ -274,6 +276,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
274
276
|
- [Faker::JapaneseMedia::Naruto](doc/japanese_media/naruto.md)
|
275
277
|
- [Faker::JapaneseMedia::Doraemon](doc/japanese_media/doraemon.md)
|
276
278
|
- [Faker::JapaneseMedia::Conan](doc/japanese_media/conan.md)
|
279
|
+
- [Faker::JapaneseMedia::FmaBrotherhood](doc/japanese_media/fullmetal_alchemist_brotherhood.md)
|
277
280
|
|
278
281
|
### Movies
|
279
282
|
- [Faker::Movie](doc/movies/movie.md)
|
@@ -318,6 +321,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
318
321
|
- [Faker::TvShows::BigBangTheory](doc/tv_shows/big_bang_theory.md)
|
319
322
|
- [Faker::TvShows::BojackHorseman](doc/tv_shows/bojack_horseman.md)
|
320
323
|
- [Faker::TvShows::BreakingBad](doc/tv_shows/breaking_bad.md)
|
324
|
+
- [Faker::TvShows::BrooklynNineNine](doc/tv_shows/brooklyn_nine_nine.md)
|
321
325
|
- [Faker::TvShows::Buffy](doc/tv_shows/buffy.md)
|
322
326
|
- [Faker::TvShows::Community](doc/tv_shows/community.md)
|
323
327
|
- [Faker::TvShows::DrWho](doc/tv_shows/dr_who.md)
|
@@ -354,9 +358,14 @@ Since you may want to make addresses and other types of data look different
|
|
354
358
|
depending on where in the world you are (US postal codes vs. UK postal codes,
|
355
359
|
for example), Faker uses the I18n gem to store strings (like state names) and
|
356
360
|
formats (US postal codes are NNNNN while UK postal codes are AAN NAA),
|
357
|
-
allowing you to get different formats by switching locales.
|
358
|
-
|
359
|
-
|
361
|
+
allowing you to get different formats by switching locales.
|
362
|
+
Just set the locale you want as shown below, and Faker will take care of the rest.
|
363
|
+
|
364
|
+
```ruby
|
365
|
+
Faker::Config.locale = 'es'
|
366
|
+
# or
|
367
|
+
Faker::Config.locale = :es
|
368
|
+
```
|
360
369
|
|
361
370
|
If your locale doesn't already exist, create it in the `lib/locales` directory
|
362
371
|
and you can then override or add elements to suit your needs. See more about how to
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Faker
|
4
|
+
class Books
|
5
|
+
class TheKingkillerChronicle < Base
|
6
|
+
class << self
|
7
|
+
##
|
8
|
+
# Produces the name of a The Kingkiller Chronicle book.
|
9
|
+
#
|
10
|
+
# @return [String]
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# Faker::Books::TheKingkillerChronicle.book #=> "The Name of the Wind"
|
14
|
+
#
|
15
|
+
# @faker.version next
|
16
|
+
def book
|
17
|
+
fetch('books.the_kingkiller_chronicle.books')
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# Produces the name of a The Kingkiller Chronicle character.
|
22
|
+
#
|
23
|
+
# @return [String]
|
24
|
+
#
|
25
|
+
# @example
|
26
|
+
# Faker::Books::TheKingkillerChronicle.character #=> "Kvothe"
|
27
|
+
#
|
28
|
+
# @faker.version next
|
29
|
+
def character
|
30
|
+
fetch('books.the_kingkiller_chronicle.characters')
|
31
|
+
end
|
32
|
+
|
33
|
+
##
|
34
|
+
# Produces the name of a The Kingkiller Chronicle creature.
|
35
|
+
#
|
36
|
+
# @return [String]
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# Faker::Books::TheKingkillerChronicle.creature #=> "Scrael"
|
40
|
+
#
|
41
|
+
# @faker.version next
|
42
|
+
def creature
|
43
|
+
fetch('books.the_kingkiller_chronicle.creatures')
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# Produces the name of a The Kingkiller Chronicle location.
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
# Faker::Books::TheKingkillerChronicle.location #=> "Tarbean"
|
53
|
+
#
|
54
|
+
# @faker.version next
|
55
|
+
def location
|
56
|
+
fetch('books.the_kingkiller_chronicle.locations')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -334,7 +334,7 @@ module Faker
|
|
334
334
|
#
|
335
335
|
# @faker.version 1.9.2
|
336
336
|
def south_african_pty_ltd_registration_number
|
337
|
-
regexify(
|
337
|
+
regexify(%r{\d{4}/\d{4,10}/07})
|
338
338
|
end
|
339
339
|
|
340
340
|
##
|
@@ -347,7 +347,7 @@ module Faker
|
|
347
347
|
#
|
348
348
|
# @faker.version 1.9.2
|
349
349
|
def south_african_close_corporation_registration_number
|
350
|
-
regexify(
|
350
|
+
regexify(%r{(CK\d{2}|\d{4})/\d{4,10}/23})
|
351
351
|
end
|
352
352
|
|
353
353
|
##
|
@@ -360,7 +360,7 @@ module Faker
|
|
360
360
|
#
|
361
361
|
# @faker.version 1.9.2
|
362
362
|
def south_african_listed_company_registration_number
|
363
|
-
regexify(
|
363
|
+
regexify(%r{\d{4}/\d{4,10}/06})
|
364
364
|
end
|
365
365
|
|
366
366
|
##
|
@@ -373,7 +373,7 @@ module Faker
|
|
373
373
|
#
|
374
374
|
# @faker.version 1.9.2
|
375
375
|
def south_african_trust_registration_number
|
376
|
-
regexify(
|
376
|
+
regexify(%r{IT\d{2,4}/\d{2,10}})
|
377
377
|
end
|
378
378
|
|
379
379
|
##
|
@@ -511,7 +511,6 @@ module Faker
|
|
511
511
|
sum
|
512
512
|
end
|
513
513
|
|
514
|
-
# rubocop:disable Style/AsciiComments
|
515
514
|
#
|
516
515
|
# For more on Russian tax number algorithm here:
|
517
516
|
# https://ru.wikipedia.org/wiki/Идентификационный_номер_налогоплательщика#Вычисление_контрольных_цифр
|
@@ -526,7 +525,6 @@ module Faker
|
|
526
525
|
# Faker::Comnpany.russian_tax_number
|
527
526
|
# Faker::Comnpany.russian_tax_number(region: 'AZ')
|
528
527
|
# Faker::Comnpany.russian_tax_number(region: 'AZ', type: false)
|
529
|
-
# rubocop:enable Style/AsciiComments
|
530
528
|
def inn_number(region, type)
|
531
529
|
n10 = [2, 4, 10, 3, 5, 9, 4, 6, 8]
|
532
530
|
n11 = [7, 2, 4, 10, 3, 5, 9, 4, 6, 8]
|
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
module Faker
|
4
4
|
class Internet < Base
|
5
|
+
# Private, Host, and Link-Local network address blocks as defined in https://en.wikipedia.org/wiki/IPv4#Special-use_addresses
|
6
|
+
PRIVATE_IPV4_ADDRESS_RANGES = [
|
7
|
+
[10..10, 0..255, 0..255, 1..255], # 10.0.0.0/8 - Used for local communications within a private network
|
8
|
+
[100..100, 64..127, 0..255, 1..255], # 100.64.0.0/10 - Shared address space for communications between an ISP and its subscribers
|
9
|
+
[127..127, 0..255, 0..255, 1..255], # 127.0.0.0/8 - Used for loopback addresses to the local host
|
10
|
+
[169..169, 254..254, 0..255, 1..255], # 169.254.0.0/16 - Used for link-local addresses between two hosts on a single link when
|
11
|
+
[172..172, 16..31, 0..255, 1..255], # 172.16.0.0/12 - Used for local communications within a private network
|
12
|
+
[192..192, 0..0, 0..0, 1..255], # 192.0.0.0/24 - IETF Protocol Assignments
|
13
|
+
[192..192, 168..168, 0..255, 1..255], # 192.168.0.0/16 - Used for local communications within a private network
|
14
|
+
[198..198, 18..19, 0..255, 1..255] # 198.18.0.0/15 - Used for benchmark testing of inter-network communications between subnets
|
15
|
+
].each(&:freeze).freeze
|
16
|
+
|
5
17
|
class << self
|
6
18
|
##
|
7
19
|
# Returns the email address
|
@@ -34,7 +46,7 @@ module Faker
|
|
34
46
|
end
|
35
47
|
|
36
48
|
##
|
37
|
-
# Returns the email address with
|
49
|
+
# Returns the email address with domain either gmail.com, yahoo.com or hotmail.com
|
38
50
|
#
|
39
51
|
# @return [String]
|
40
52
|
#
|
@@ -80,10 +92,10 @@ module Faker
|
|
80
92
|
#
|
81
93
|
# @return [String]
|
82
94
|
#
|
83
|
-
# @param specifier [Integer, Range] When int value passed it returns the username longer than specifier. Max value can be 10^6
|
84
|
-
# @param
|
95
|
+
# @param specifier [Integer, Range, String] When int value passed it returns the username longer than specifier. Max value can be 10^6
|
96
|
+
# @param separators [Array]
|
85
97
|
#
|
86
|
-
# @
|
98
|
+
# @example
|
87
99
|
# Faker::Internet.username(specifier: 10) #=> "lulu.goodwin"
|
88
100
|
# Faker::Internet.username(specifier: 5..10) #=> "morris"
|
89
101
|
# Faker::Internet.username(specifier: 5..10) #=> "berryberry"
|
@@ -227,8 +239,6 @@ module Faker
|
|
227
239
|
end
|
228
240
|
end
|
229
241
|
|
230
|
-
# rubocop:disable Style/AsciiComments
|
231
|
-
|
232
242
|
##
|
233
243
|
# Fixes ä, ö, ü, ß characters in string passed with ae, oe, ue, ss resp.
|
234
244
|
#
|
@@ -247,7 +257,6 @@ module Faker
|
|
247
257
|
|
248
258
|
Char.fix_umlauts(string)
|
249
259
|
end
|
250
|
-
# rubocop:enable Style/AsciiComments
|
251
260
|
|
252
261
|
##
|
253
262
|
# Returns the domain word for internet
|
@@ -264,7 +273,7 @@ module Faker
|
|
264
273
|
#
|
265
274
|
# @return [String]
|
266
275
|
#
|
267
|
-
# @
|
276
|
+
# @example
|
268
277
|
# Faker::Internet.domain_suffix #=> "com"
|
269
278
|
# Faker::Internet.domain_suffix #=> "biz"
|
270
279
|
def domain_suffix
|
@@ -311,12 +320,7 @@ module Faker
|
|
311
320
|
# @example
|
312
321
|
# Faker::Internet.private_ip_v4_address #=> "127.120.80.42"
|
313
322
|
def private_ip_v4_address
|
314
|
-
|
315
|
-
loop do
|
316
|
-
addr = ip_v4_address
|
317
|
-
break if private_net_checker[addr]
|
318
|
-
end
|
319
|
-
addr
|
323
|
+
sample(PRIVATE_IPV4_ADDRESS_RANGES).map { |range| rand(range) }.join('.')
|
320
324
|
end
|
321
325
|
|
322
326
|
##
|
@@ -387,7 +391,7 @@ module Faker
|
|
387
391
|
end
|
388
392
|
|
389
393
|
##
|
390
|
-
# Returns lambda function to check address passed is
|
394
|
+
# Returns lambda function to check address passed is reserved or not
|
391
395
|
#
|
392
396
|
# @return [Lambda]
|
393
397
|
#
|
@@ -479,7 +483,9 @@ module Faker
|
|
479
483
|
end
|
480
484
|
|
481
485
|
glue ||= sample(%w[- _])
|
482
|
-
|
486
|
+
return words.delete(',.').gsub(' ', glue).downcase unless words.nil?
|
487
|
+
|
488
|
+
sample(translate('faker.internet.slug'), 2).join(glue)
|
483
489
|
end
|
484
490
|
|
485
491
|
##
|
@@ -530,6 +536,35 @@ module Faker
|
|
530
536
|
'%08x-%04x-%04x-%04x-%04x%08x' % ary # rubocop:disable Style/FormatString
|
531
537
|
end
|
532
538
|
|
539
|
+
##
|
540
|
+
# Produces a random string of alphabetic characters, (no digits)
|
541
|
+
#
|
542
|
+
# @param length [Integer] The length of the string to generate
|
543
|
+
# @param padding [Boolean] Toggles if a final equal '=' will be added.
|
544
|
+
# @param urlsafe [Boolean] Toggles charset to '-' and '_' instead of '+' and '/'.
|
545
|
+
#
|
546
|
+
# @return [String]
|
547
|
+
#
|
548
|
+
# @example
|
549
|
+
# Faker::Internet.base64
|
550
|
+
# #=> "r_hbZ2DSD-ZACzZT"
|
551
|
+
# @example
|
552
|
+
# Faker::Internet.base64(length: 4, padding: true, urlsafe: false)
|
553
|
+
# #=> "x1/R="
|
554
|
+
#
|
555
|
+
# @faker.version 2.11.0
|
556
|
+
def base64(length: 16, padding: false, urlsafe: true)
|
557
|
+
char_range = [
|
558
|
+
Array('0'..'9'),
|
559
|
+
Array('A'..'Z'),
|
560
|
+
Array('a'..'z'),
|
561
|
+
urlsafe ? %w[- _] : %w[+ /]
|
562
|
+
].flatten
|
563
|
+
s = Array.new(length) { sample(char_range) }.join
|
564
|
+
s += '=' if padding
|
565
|
+
s
|
566
|
+
end
|
567
|
+
|
533
568
|
##
|
534
569
|
# Produces a randomized hash of internet user details
|
535
570
|
# @example
|
data/lib/faker/default/lorem.rb
CHANGED
@@ -82,8 +82,6 @@ module Faker
|
|
82
82
|
Alphanumeric.alphanumeric(number: number, min_alpha: min_alpha, min_numeric: min_numeric)
|
83
83
|
end
|
84
84
|
|
85
|
-
# rubocop:disable Style/AsciiComments
|
86
|
-
|
87
85
|
##
|
88
86
|
# Generates the emoji
|
89
87
|
#
|
@@ -97,8 +95,6 @@ module Faker
|
|
97
95
|
def multibyte
|
98
96
|
sample(translate('faker.lorem.multibyte')).pack('C*').force_encoding('utf-8')
|
99
97
|
end
|
100
|
-
# rubocop:enable Style/AsciiComments
|
101
|
-
|
102
98
|
# rubocop:disable Metrics/ParameterLists
|
103
99
|
|
104
100
|
##
|
data/lib/faker/default/nation.rb
CHANGED
@@ -17,8 +17,6 @@ module Faker
|
|
17
17
|
fetch('nation.nationality')
|
18
18
|
end
|
19
19
|
|
20
|
-
# rubocop:disable Style/AsciiComments
|
21
|
-
|
22
20
|
##
|
23
21
|
# Produces a random national flag emoji.
|
24
22
|
#
|
@@ -31,7 +29,6 @@ module Faker
|
|
31
29
|
def flag
|
32
30
|
sample(translate('faker.nation.flag')).pack('C*').force_encoding('utf-8')
|
33
31
|
end
|
34
|
-
# rubocop:enable Style/AsciiComments
|
35
32
|
|
36
33
|
##
|
37
34
|
# Produces a random national language.
|
@@ -65,7 +65,7 @@ module Faker
|
|
65
65
|
picture: image,
|
66
66
|
gender: gender,
|
67
67
|
birthday: Date.backward(days: 36_400).strftime('%Y-%m-%d'),
|
68
|
-
|
68
|
+
locale: 'en',
|
69
69
|
hd: "#{Company.name.downcase}.com"
|
70
70
|
},
|
71
71
|
id_info: {
|
@@ -431,6 +431,50 @@ module Faker
|
|
431
431
|
}
|
432
432
|
end
|
433
433
|
|
434
|
+
##
|
435
|
+
# Generate a mock Omniauth response from Auth0.
|
436
|
+
#
|
437
|
+
# @param name [String] A specific name to return in the response.
|
438
|
+
# @param email [String] A specific email to return in the response.
|
439
|
+
# @param uid [String] A specific UID to return in the response.
|
440
|
+
#
|
441
|
+
# @return [Hash] An auth hash in the format provided by omniauth-auth0.
|
442
|
+
#
|
443
|
+
# @faker.version next
|
444
|
+
def auth0(name: nil, email: nil, uid: nil)
|
445
|
+
uid ||= "auth0|#{Number.hexadecimal(digits: 24)}"
|
446
|
+
auth = Omniauth.new(name: name, email: email)
|
447
|
+
{
|
448
|
+
provider: 'auth0',
|
449
|
+
uid: uid,
|
450
|
+
info: {
|
451
|
+
name: uid,
|
452
|
+
nickname: auth.name,
|
453
|
+
email: auth.email,
|
454
|
+
image: image
|
455
|
+
},
|
456
|
+
credentials: {
|
457
|
+
expires_at: Time.forward.to_i,
|
458
|
+
expires: true,
|
459
|
+
token_type: 'Bearer',
|
460
|
+
id_token: Crypto.sha256,
|
461
|
+
token: Crypto.md5,
|
462
|
+
refresh_token: Crypto.md5
|
463
|
+
},
|
464
|
+
extra: {
|
465
|
+
raw_info: {
|
466
|
+
email: auth.email,
|
467
|
+
email_verified: true,
|
468
|
+
iss: 'https://auth0.com/',
|
469
|
+
sub: uid,
|
470
|
+
aud: 'Auth012345',
|
471
|
+
iat: Time.forward.to_i,
|
472
|
+
exp: Time.forward.to_i
|
473
|
+
}
|
474
|
+
}
|
475
|
+
}
|
476
|
+
end
|
477
|
+
|
434
478
|
private
|
435
479
|
|
436
480
|
def gender
|
data/lib/faker/default/string.rb
CHANGED
@@ -3,8 +3,6 @@
|
|
3
3
|
module Faker
|
4
4
|
class String < Base
|
5
5
|
class << self
|
6
|
-
# rubocop:disable Style/AsciiComments
|
7
|
-
|
8
6
|
##
|
9
7
|
# Produces a random UTF-8 string with optional nested length selectors.
|
10
8
|
#
|
@@ -26,7 +24,6 @@ module Faker
|
|
26
24
|
|
27
25
|
utf8string select_a length
|
28
26
|
end
|
29
|
-
# rubocop:enable Style/AsciiComments
|
30
27
|
|
31
28
|
private
|
32
29
|
|
data/lib/faker/default/time.rb
CHANGED
@@ -14,7 +14,6 @@ module Faker
|
|
14
14
|
|
15
15
|
class << self
|
16
16
|
# rubocop:disable Metrics/ParameterLists
|
17
|
-
# rubocop:disable Style/AsciiComments
|
18
17
|
|
19
18
|
##
|
20
19
|
# Produce a random time between two times.
|
@@ -51,7 +50,6 @@ module Faker
|
|
51
50
|
time = Faker::Base.rand_in_range(from, to)
|
52
51
|
time_with_format(time, format)
|
53
52
|
end
|
54
|
-
# rubocop:enable Style/AsciiComments
|
55
53
|
|
56
54
|
##
|
57
55
|
# Produce a random time between two dates.
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Faker
|
4
|
+
class JapaneseMedia
|
5
|
+
class FmaBrotherhood < Base
|
6
|
+
class << self
|
7
|
+
##
|
8
|
+
# Produces a character from FmaBrotherhood.
|
9
|
+
#
|
10
|
+
# @return [String]
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# Faker::JapaneseMedia::FmaBrotherhood.character #=> "Edward Elric"
|
14
|
+
#
|
15
|
+
# @faker.version next
|
16
|
+
def character
|
17
|
+
fetch('fma_brotherhood.characters')
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# Produces a cities from FmaBrotherhood.
|
22
|
+
#
|
23
|
+
# @return [String]
|
24
|
+
#
|
25
|
+
# @example
|
26
|
+
# Faker::JapaneseMedia::FmaBrotherhood.city #=> "Central City"
|
27
|
+
#
|
28
|
+
# @faker.version next
|
29
|
+
def city
|
30
|
+
fetch('fma_brotherhood.cities')
|
31
|
+
end
|
32
|
+
|
33
|
+
##
|
34
|
+
# Produces a country from FmaBrotherhood.
|
35
|
+
#
|
36
|
+
# @return [String]
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# Faker::JapaneseMedia::FmaBrotherhood.country #=> "Xing"
|
40
|
+
#
|
41
|
+
# @faker.version next
|
42
|
+
def country
|
43
|
+
fetch('fma_brotherhood.countries')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Faker
|
4
|
+
class JapaneseMedia
|
5
|
+
class KamenRider < Base
|
6
|
+
class << self
|
7
|
+
ERAS = %i[showa heisei reiwa].freeze
|
8
|
+
|
9
|
+
def eras=(new_eras)
|
10
|
+
selected_eras = ERAS & new_eras
|
11
|
+
@eras = selected_eras.empty? ? ERAS : selected_eras
|
12
|
+
end
|
13
|
+
|
14
|
+
##
|
15
|
+
# Produces the name of a Kamen Rider from a series in the given era.
|
16
|
+
#
|
17
|
+
# @return [String]
|
18
|
+
#
|
19
|
+
# @example
|
20
|
+
# Faker::JapaneseMedia::KamenRider.kamen_rider #=> "Kamen Rider Revice"
|
21
|
+
#
|
22
|
+
# @faker.version next
|
23
|
+
def kamen_rider(*eras)
|
24
|
+
from_eras(*eras, field: :kamen_riders)
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Produces the name of a main user of Kamen Rider.
|
29
|
+
#
|
30
|
+
# @return [String]
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
# Faker::JapaneseMedia::KamenRider.user #=> "Ikki Igarashi"
|
34
|
+
#
|
35
|
+
# @faker.version next
|
36
|
+
def user(*eras)
|
37
|
+
from_eras(*eras, field: :users)
|
38
|
+
end
|
39
|
+
|
40
|
+
##
|
41
|
+
# Produces the name of a Kamen Rider series.
|
42
|
+
#
|
43
|
+
# @return [String]
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
# Faker::JapaneseMedia::KamenRider.series #=> "Kamen Rider Revice"
|
47
|
+
#
|
48
|
+
# @faker.version next
|
49
|
+
def series(*eras)
|
50
|
+
from_eras(*eras, field: :series)
|
51
|
+
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# Produces the name of a collectible device from a Kamen Rider series.
|
55
|
+
#
|
56
|
+
# @return [String]
|
57
|
+
#
|
58
|
+
# @example
|
59
|
+
# Faker::JapaneseMedia::KamenRider.collectible_device #=> "Vistamp"
|
60
|
+
#
|
61
|
+
# @faker.version next
|
62
|
+
def collectible_device(*eras)
|
63
|
+
from_eras(*eras, field: :collectible_devices) { |e| e.delete(:showa) }
|
64
|
+
end
|
65
|
+
|
66
|
+
# Produces the name of a transformation device used by a Kamen Rider
|
67
|
+
# from the given eras.
|
68
|
+
#
|
69
|
+
# @return [String]
|
70
|
+
#
|
71
|
+
# @example Faker::JapaneseMedia::KamenRider.transformation_device #=>
|
72
|
+
# "Revice Driver"
|
73
|
+
#
|
74
|
+
# @faker.version next
|
75
|
+
def transformation_device(*eras)
|
76
|
+
from_eras(*eras, field: :transformation_devices)
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
def eras
|
82
|
+
@eras ||= ERAS
|
83
|
+
end
|
84
|
+
|
85
|
+
def from_eras(*input_eras, field:)
|
86
|
+
selected_eras = (ERAS & input_eras).yield_self do |selected|
|
87
|
+
selected.empty? ? eras : selected
|
88
|
+
end.dup
|
89
|
+
yield(selected_eras) if block_given?
|
90
|
+
|
91
|
+
raise UnavailableInEra, "#{field} is unavailable in the selected eras." if selected_eras.empty?
|
92
|
+
|
93
|
+
selected_eras.sample.yield_self do |era|
|
94
|
+
fetch("kamen_rider.#{era}.#{field}")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
class UnavailableInEra < StandardError; end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Faker
|
4
|
+
module Religion
|
5
|
+
class Bible < Base
|
6
|
+
flexible :bible
|
7
|
+
|
8
|
+
class << self
|
9
|
+
##
|
10
|
+
# Returns a random bible character.
|
11
|
+
#
|
12
|
+
# @return [String]
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# Faker::Religion::Bible.character #=> "Jesus"
|
16
|
+
#
|
17
|
+
# @faker.version next
|
18
|
+
def character
|
19
|
+
fetch('bible.character')
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# Returns a random location(city or town) from the bible
|
24
|
+
#
|
25
|
+
# @return [String]
|
26
|
+
#
|
27
|
+
# @example
|
28
|
+
# Faker::Religion::Bible.location #=> "Nasareth"
|
29
|
+
#
|
30
|
+
# @faker.version next
|
31
|
+
def location
|
32
|
+
fetch('bible.location')
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# Returns a random quote from the location.
|
37
|
+
#
|
38
|
+
# @return [String]
|
39
|
+
#
|
40
|
+
# @example
|
41
|
+
# Faker::Religion::Bible.quote #=> "Seek first the kingdom of God "
|
42
|
+
#
|
43
|
+
# @faker.version next
|
44
|
+
def quote
|
45
|
+
fetch('bible.quote')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Faker
|
4
|
+
class TvShows
|
5
|
+
class BrooklynNineNine < Base
|
6
|
+
flexible :brooklyn_nine_nine
|
7
|
+
|
8
|
+
class << self
|
9
|
+
##
|
10
|
+
# Produces a character from Brooklyn Nine Nine.
|
11
|
+
#
|
12
|
+
# @return [String]
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# Faker::TvShows::BrooklynNineNine.character #=> "Jake Peralta"
|
16
|
+
#
|
17
|
+
# @faker.version next
|
18
|
+
def character
|
19
|
+
fetch('brooklyn_nine_nine.characters')
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# Produces a quote from Brooklyn Nine Nine.
|
24
|
+
#
|
25
|
+
# @return [String]
|
26
|
+
#
|
27
|
+
# @example
|
28
|
+
# Faker::TvShows::BrooklynNineNine.quote
|
29
|
+
# #=> "Cool, cool, cool, cool, cool. No doubt, no doubt, no doubt."
|
30
|
+
#
|
31
|
+
# @faker.version next
|
32
|
+
def quote
|
33
|
+
fetch('brooklyn_nine_nine.quotes')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|