faker 2.8.0 → 2.10.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 +185 -18
- data/README.md +1 -1
- data/lib/faker.rb +3 -5
- data/lib/faker/default/address.rb +215 -0
- data/lib/faker/default/ancient.rb +36 -0
- data/lib/faker/default/bank.rb +1 -1
- data/lib/faker/default/beer.rb +72 -0
- data/lib/faker/default/bossa_nova.rb +18 -0
- data/lib/faker/default/business.rb +27 -0
- data/lib/faker/default/chuck_norris.rb +11 -1
- data/lib/faker/default/color.rb +48 -1
- data/lib/faker/default/company.rb +236 -4
- data/lib/faker/default/crypto.rb +27 -0
- data/lib/faker/default/currency.rb +27 -0
- data/lib/faker/default/dc_comics.rb +45 -0
- data/lib/faker/default/demographic.rb +57 -0
- data/lib/faker/default/educator.rb +60 -6
- data/lib/faker/default/esport.rb +45 -0
- data/lib/faker/default/file.rb +2 -2
- data/lib/faker/default/fillmurray.rb +23 -1
- data/lib/faker/default/food.rb +65 -1
- data/lib/faker/default/gender.rb +13 -0
- data/lib/faker/default/internet.rb +13 -4
- data/lib/faker/default/job.rb +36 -0
- data/lib/faker/default/kpop.rb +54 -0
- data/lib/faker/default/lorem.rb +1 -1
- data/lib/faker/default/space.rb +127 -0
- data/lib/faker/default/team.rb +45 -0
- data/lib/faker/music/music.rb +90 -4
- data/lib/faker/music/opera.rb +36 -0
- data/lib/faker/version.rb +1 -1
- data/lib/helpers/unique_generator.rb +4 -0
- data/lib/locales/bg.yml +2 -2
- data/lib/locales/ca.yml +0 -8
- data/lib/locales/da-DK.yml +3 -3
- data/lib/locales/en-NEP.yml +1 -1
- data/lib/locales/en-NZ.yml +132 -8
- data/lib/locales/en-ZA.yml +1 -1
- data/lib/locales/en/address.yml +4 -0
- data/lib/locales/en/color.yml +1 -1
- data/lib/locales/en/educator.yml +69 -6
- data/lib/locales/en/gender.yml +1 -0
- data/lib/locales/en/phone_number.yml +1 -1
- data/lib/locales/en/shakespeare.yml +3 -3
- data/lib/locales/en/stripe.yml +3 -3
- data/lib/locales/es-MX.yml +3 -0
- data/lib/locales/fa.yml +2 -0
- data/lib/locales/fr-CA.yml +5 -4
- data/lib/locales/fr-CH.yml +1 -1
- data/lib/locales/fr.yml +5 -4
- data/lib/locales/hy.yml +1 -6
- data/lib/locales/id.yml +2 -1
- data/lib/locales/ja.yml +1 -1
- data/lib/locales/pt-BR.yml +23 -2
- data/lib/locales/pt.yml +2 -2
- data/lib/locales/uk.yml +5 -5
- data/lib/locales/zh-CN.yml +1 -1
- data/lib/locales/zh-TW.yml +1 -1
- metadata +12 -12
data/lib/faker/default/crypto.rb
CHANGED
|
@@ -5,14 +5,41 @@ require 'digest'
|
|
|
5
5
|
module Faker
|
|
6
6
|
class Crypto < Base
|
|
7
7
|
class << self
|
|
8
|
+
##
|
|
9
|
+
# Produces an MD5 hash.
|
|
10
|
+
#
|
|
11
|
+
# @return [String]
|
|
12
|
+
#
|
|
13
|
+
# @example
|
|
14
|
+
# Faker::Crypto.md5 #=> "6b5ed240042e8a65c55ddb826c3408e6"
|
|
15
|
+
#
|
|
16
|
+
# @faker.version 1.6.4
|
|
8
17
|
def md5
|
|
9
18
|
Digest::MD5.hexdigest(Lorem.characters)
|
|
10
19
|
end
|
|
11
20
|
|
|
21
|
+
##
|
|
22
|
+
# Produces a SHA1 hash.
|
|
23
|
+
#
|
|
24
|
+
# @return [String]
|
|
25
|
+
#
|
|
26
|
+
# @example
|
|
27
|
+
# Faker::Crypto.sha1 #=> "4e99e31c51eef8b2d290e709f757f92e558a503f"
|
|
28
|
+
#
|
|
29
|
+
# @faker.version 1.6.4
|
|
12
30
|
def sha1
|
|
13
31
|
Digest::SHA1.hexdigest(Lorem.characters)
|
|
14
32
|
end
|
|
15
33
|
|
|
34
|
+
##
|
|
35
|
+
# Produces a SHA256 hash.
|
|
36
|
+
#
|
|
37
|
+
# @return [String]
|
|
38
|
+
#
|
|
39
|
+
# @example
|
|
40
|
+
# Faker::Crypto.sha256 #=> "51e4dbb424cd9db1ec5fb989514f2a35652ececef33f21c8dd1fd61bb8e3929d"
|
|
41
|
+
#
|
|
42
|
+
# @faker.version 1.6.4
|
|
16
43
|
def sha256
|
|
17
44
|
Digest::SHA256.hexdigest(Lorem.characters)
|
|
18
45
|
end
|
|
@@ -3,14 +3,41 @@
|
|
|
3
3
|
module Faker
|
|
4
4
|
class Currency < Base
|
|
5
5
|
class << self
|
|
6
|
+
##
|
|
7
|
+
# Produces the name of a currency.
|
|
8
|
+
#
|
|
9
|
+
# @return [String]
|
|
10
|
+
#
|
|
11
|
+
# @example
|
|
12
|
+
# Faker::Currency.name #=> "Swedish Krona"
|
|
13
|
+
#
|
|
14
|
+
# @faker.version 1.9.0
|
|
6
15
|
def name
|
|
7
16
|
fetch('currency.name')
|
|
8
17
|
end
|
|
9
18
|
|
|
19
|
+
##
|
|
20
|
+
# Produces a currency code.
|
|
21
|
+
#
|
|
22
|
+
# @return [String]
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
# Faker::Currency.code #=> "USD"
|
|
26
|
+
#
|
|
27
|
+
# @faker.version 1.9.0
|
|
10
28
|
def code
|
|
11
29
|
fetch('currency.code')
|
|
12
30
|
end
|
|
13
31
|
|
|
32
|
+
##
|
|
33
|
+
# Produces a currency symbol.
|
|
34
|
+
#
|
|
35
|
+
# @return [String]
|
|
36
|
+
#
|
|
37
|
+
# @example
|
|
38
|
+
# Faker::Currency.symbol #=> "$"
|
|
39
|
+
#
|
|
40
|
+
# @faker.version 1.9.0
|
|
14
41
|
def symbol
|
|
15
42
|
fetch('currency.symbol')
|
|
16
43
|
end
|
|
@@ -2,22 +2,67 @@
|
|
|
2
2
|
|
|
3
3
|
module Faker
|
|
4
4
|
class DcComics < Base
|
|
5
|
+
##
|
|
6
|
+
# Produces a hero name from DC Comics
|
|
7
|
+
#
|
|
8
|
+
# @return [String]
|
|
9
|
+
#
|
|
10
|
+
# @example
|
|
11
|
+
# Faker::DcComics.hero #=> "Batman"
|
|
12
|
+
#
|
|
13
|
+
# @faker.version 1.9.2
|
|
5
14
|
def self.hero
|
|
6
15
|
fetch('dc_comics.hero')
|
|
7
16
|
end
|
|
8
17
|
|
|
18
|
+
##
|
|
19
|
+
# Produces a heroine name from DC Comics
|
|
20
|
+
#
|
|
21
|
+
# @return [String]
|
|
22
|
+
#
|
|
23
|
+
# @example
|
|
24
|
+
# Faker::DcComics.heroine #=> "Supergirl"
|
|
25
|
+
#
|
|
26
|
+
# @faker.version 1.9.2
|
|
9
27
|
def self.heroine
|
|
10
28
|
fetch('dc_comics.heroine')
|
|
11
29
|
end
|
|
12
30
|
|
|
31
|
+
##
|
|
32
|
+
# Produces a villain name from DC Comics
|
|
33
|
+
#
|
|
34
|
+
# @return [String]
|
|
35
|
+
#
|
|
36
|
+
# @example
|
|
37
|
+
# Faker::DcComics.villain #=> "The Joker"
|
|
38
|
+
#
|
|
39
|
+
# @faker.version 1.9.2
|
|
13
40
|
def self.villain
|
|
14
41
|
fetch('dc_comics.villain')
|
|
15
42
|
end
|
|
16
43
|
|
|
44
|
+
##
|
|
45
|
+
# Produces a character name from DC Comics
|
|
46
|
+
#
|
|
47
|
+
# @return [String]
|
|
48
|
+
#
|
|
49
|
+
# @example
|
|
50
|
+
# Faker::DcComics.name #=> "Clark Kent"
|
|
51
|
+
#
|
|
52
|
+
# @faker.version 1.9.2
|
|
17
53
|
def self.name
|
|
18
54
|
fetch('dc_comics.name')
|
|
19
55
|
end
|
|
20
56
|
|
|
57
|
+
##
|
|
58
|
+
# Produces a comic book title from DC Comics
|
|
59
|
+
#
|
|
60
|
+
# @return [String]
|
|
61
|
+
#
|
|
62
|
+
# @example
|
|
63
|
+
# Faker::DcComics.title #=> "Batman: The Long Halloween"
|
|
64
|
+
#
|
|
65
|
+
# @faker.version 1.9.2
|
|
21
66
|
def self.title
|
|
22
67
|
fetch('dc_comics.title')
|
|
23
68
|
end
|
|
@@ -3,26 +3,83 @@
|
|
|
3
3
|
module Faker
|
|
4
4
|
class Demographic < Base
|
|
5
5
|
class << self
|
|
6
|
+
##
|
|
7
|
+
# Produces the name of a race.
|
|
8
|
+
#
|
|
9
|
+
# @return [String]
|
|
10
|
+
#
|
|
11
|
+
# @example
|
|
12
|
+
# Faker::Demographic.race #=> "Native Hawaiian or Other Pacific Islander"
|
|
13
|
+
#
|
|
14
|
+
# @faker.version 1.7.3
|
|
6
15
|
def race
|
|
7
16
|
fetch('demographic.race')
|
|
8
17
|
end
|
|
9
18
|
|
|
19
|
+
##
|
|
20
|
+
# Produces a level of educational attainment.
|
|
21
|
+
#
|
|
22
|
+
# @return [String]
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
# Faker::Demographic.educational_attainment #=> "GED or alternative credential"
|
|
26
|
+
#
|
|
27
|
+
# @faker.version 1.7.3
|
|
10
28
|
def educational_attainment
|
|
11
29
|
fetch('demographic.educational_attainment')
|
|
12
30
|
end
|
|
13
31
|
|
|
32
|
+
##
|
|
33
|
+
# Produces a denonym.
|
|
34
|
+
#
|
|
35
|
+
# @return [String]
|
|
36
|
+
#
|
|
37
|
+
# @example
|
|
38
|
+
# Faker::Demographic.denonym #=> "Panamanian"
|
|
39
|
+
#
|
|
40
|
+
# @faker.version 1.7.3
|
|
14
41
|
def demonym
|
|
15
42
|
fetch('demographic.demonym')
|
|
16
43
|
end
|
|
17
44
|
|
|
45
|
+
##
|
|
46
|
+
# Produces a marital status.
|
|
47
|
+
#
|
|
48
|
+
# @return [String]
|
|
49
|
+
#
|
|
50
|
+
# @example
|
|
51
|
+
# Faker::Demographic.marital_status #=> "Widowed"
|
|
52
|
+
#
|
|
53
|
+
# @faker.version 1.7.3
|
|
18
54
|
def marital_status
|
|
19
55
|
fetch('demographic.marital_status')
|
|
20
56
|
end
|
|
21
57
|
|
|
58
|
+
##
|
|
59
|
+
# Produces a sex for demographic purposes.
|
|
60
|
+
#
|
|
61
|
+
# @return [String]
|
|
62
|
+
#
|
|
63
|
+
# @example
|
|
64
|
+
# Faker::Demographic.sex #=> "Female"
|
|
65
|
+
#
|
|
66
|
+
# @faker.version 1.7.3
|
|
22
67
|
def sex
|
|
23
68
|
fetch('demographic.sex')
|
|
24
69
|
end
|
|
25
70
|
|
|
71
|
+
##
|
|
72
|
+
# Produces a height as a string.
|
|
73
|
+
#
|
|
74
|
+
# @param unit [Symbol] either `:metric` or `imperial`.
|
|
75
|
+
# @return [String]
|
|
76
|
+
#
|
|
77
|
+
# @example
|
|
78
|
+
# Faker::Demographic.height #=> "1.61"
|
|
79
|
+
# @example
|
|
80
|
+
# Faker::Demographic.height(unit: :imperial) #=> "6 ft, 2 in"
|
|
81
|
+
#
|
|
82
|
+
# @faker.version 1.7.3
|
|
26
83
|
def height(legacy_unit = NOT_GIVEN, unit: :metric)
|
|
27
84
|
warn_for_deprecated_arguments do |keywords|
|
|
28
85
|
keywords << :unit if legacy_unit != NOT_GIVEN
|
|
@@ -5,30 +5,84 @@ module Faker
|
|
|
5
5
|
flexible :educator
|
|
6
6
|
|
|
7
7
|
class << self
|
|
8
|
+
##
|
|
9
|
+
# Produces a university name.
|
|
10
|
+
#
|
|
11
|
+
# @return [String]
|
|
12
|
+
#
|
|
13
|
+
# @example
|
|
14
|
+
# Faker::Educator.university #=> "Mallowtown Technical College"
|
|
15
|
+
#
|
|
16
|
+
# @faker.version 1.6.4
|
|
8
17
|
def university
|
|
9
|
-
|
|
18
|
+
parse('educator.university')
|
|
10
19
|
end
|
|
11
20
|
|
|
21
|
+
##
|
|
22
|
+
# Produces a university degree.
|
|
23
|
+
#
|
|
24
|
+
# @return [String]
|
|
25
|
+
#
|
|
26
|
+
# @example
|
|
27
|
+
# Faker::Educator.degree #=> "Associate Degree in Criminology"
|
|
28
|
+
#
|
|
29
|
+
# @faker.version 1.9.2
|
|
12
30
|
def degree
|
|
13
|
-
|
|
31
|
+
parse('educator.degree')
|
|
14
32
|
end
|
|
15
33
|
|
|
16
34
|
alias course degree
|
|
17
35
|
|
|
36
|
+
##
|
|
37
|
+
# Produces a university subject.
|
|
38
|
+
#
|
|
39
|
+
# @return [String]
|
|
40
|
+
#
|
|
41
|
+
# @example
|
|
42
|
+
# Faker::Educator.subject #=> "Criminology"
|
|
43
|
+
#
|
|
44
|
+
# @faker.version 1.9.2
|
|
18
45
|
def subject
|
|
19
|
-
fetch('educator.
|
|
46
|
+
fetch('educator.subject')
|
|
20
47
|
end
|
|
21
48
|
|
|
49
|
+
##
|
|
50
|
+
# Produces a course name.
|
|
51
|
+
#
|
|
52
|
+
# @return [String]
|
|
53
|
+
#
|
|
54
|
+
# @example
|
|
55
|
+
# Faker::Educator.course_name #=> "Criminology 101"
|
|
56
|
+
#
|
|
57
|
+
# @faker.version 1.9.2
|
|
22
58
|
def course_name
|
|
23
|
-
|
|
59
|
+
numerify(parse('educator.course_name'))
|
|
24
60
|
end
|
|
25
61
|
|
|
62
|
+
##
|
|
63
|
+
# Produces a secondary school.
|
|
64
|
+
#
|
|
65
|
+
# @return [String]
|
|
66
|
+
#
|
|
67
|
+
# @example
|
|
68
|
+
# Faker::Educator.secondary_school #=> "Iceborough Secondary College"
|
|
69
|
+
#
|
|
70
|
+
# @faker.version 1.6.4
|
|
26
71
|
def secondary_school
|
|
27
|
-
|
|
72
|
+
parse('educator.secondary_school')
|
|
28
73
|
end
|
|
29
74
|
|
|
75
|
+
##
|
|
76
|
+
# Produces a campus name.
|
|
77
|
+
#
|
|
78
|
+
# @return [String]
|
|
79
|
+
#
|
|
80
|
+
# @example
|
|
81
|
+
# Faker::Educator.campus #=> "Vertapple Campus"
|
|
82
|
+
#
|
|
83
|
+
# @faker.version 1.6.4
|
|
30
84
|
def campus
|
|
31
|
-
|
|
85
|
+
parse('educator.campus')
|
|
32
86
|
end
|
|
33
87
|
end
|
|
34
88
|
end
|
data/lib/faker/default/esport.rb
CHANGED
|
@@ -3,22 +3,67 @@
|
|
|
3
3
|
module Faker
|
|
4
4
|
class Esport < Base
|
|
5
5
|
class << self
|
|
6
|
+
##
|
|
7
|
+
# Produces the name of a professional eSports player.
|
|
8
|
+
#
|
|
9
|
+
# @return [String]
|
|
10
|
+
#
|
|
11
|
+
# @example
|
|
12
|
+
# Faker::Esport.player #=> "Crimsix"
|
|
13
|
+
#
|
|
14
|
+
# @faker.version 1.7.0
|
|
6
15
|
def player
|
|
7
16
|
fetch('esport.players')
|
|
8
17
|
end
|
|
9
18
|
|
|
19
|
+
##
|
|
20
|
+
# Produces the name of an eSports team.
|
|
21
|
+
#
|
|
22
|
+
# @return [String]
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
# Faker::Esport.team #=> "CLG"
|
|
26
|
+
#
|
|
27
|
+
# @faker.version 1.7.0
|
|
10
28
|
def team
|
|
11
29
|
fetch('esport.teams')
|
|
12
30
|
end
|
|
13
31
|
|
|
32
|
+
##
|
|
33
|
+
# Produces the name of an eSports league.
|
|
34
|
+
#
|
|
35
|
+
# @return [String]
|
|
36
|
+
#
|
|
37
|
+
# @example
|
|
38
|
+
# Faker::Esport.league #=> "IEM"
|
|
39
|
+
#
|
|
40
|
+
# @faker.version 1.7.0
|
|
14
41
|
def league
|
|
15
42
|
fetch('esport.leagues')
|
|
16
43
|
end
|
|
17
44
|
|
|
45
|
+
##
|
|
46
|
+
# Produces the name of an eSports event.
|
|
47
|
+
#
|
|
48
|
+
# @return [String]
|
|
49
|
+
#
|
|
50
|
+
# @example
|
|
51
|
+
# Faker::Esport.event #=> "ESL Cologne"
|
|
52
|
+
#
|
|
53
|
+
# @faker.version 1.7.0
|
|
18
54
|
def event
|
|
19
55
|
fetch('esport.events')
|
|
20
56
|
end
|
|
21
57
|
|
|
58
|
+
##
|
|
59
|
+
# Produces the name of a game played as an eSport.
|
|
60
|
+
#
|
|
61
|
+
# @return [String]
|
|
62
|
+
#
|
|
63
|
+
# @example
|
|
64
|
+
# Faker::Esport.game #=> "Dota 2"
|
|
65
|
+
#
|
|
66
|
+
# @faker.version 1.7.0
|
|
22
67
|
def game
|
|
23
68
|
fetch('esport.games')
|
|
24
69
|
end
|
data/lib/faker/default/file.rb
CHANGED
|
@@ -4,7 +4,7 @@ module Faker
|
|
|
4
4
|
class File < Base
|
|
5
5
|
class << self
|
|
6
6
|
# rubocop:disable Metrics/ParameterLists
|
|
7
|
-
def dir(legacy_segment_count = NOT_GIVEN, legacy_root = NOT_GIVEN, legacy_directory_separator = NOT_GIVEN, segment_count: 3, root: nil, directory_separator:
|
|
7
|
+
def dir(legacy_segment_count = NOT_GIVEN, legacy_root = NOT_GIVEN, legacy_directory_separator = NOT_GIVEN, segment_count: 3, root: nil, directory_separator: ::File::Separator)
|
|
8
8
|
# rubocop:enable Metrics/ParameterLists
|
|
9
9
|
warn_for_deprecated_arguments do |keywords|
|
|
10
10
|
keywords << :segment_count if legacy_segment_count != NOT_GIVEN
|
|
@@ -29,7 +29,7 @@ module Faker
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
# rubocop:disable Metrics/ParameterLists
|
|
32
|
-
def file_name(legacy_dir = NOT_GIVEN, legacy_name = NOT_GIVEN, legacy_ext = NOT_GIVEN, legacy_directory_separator = NOT_GIVEN, dir: nil, name: nil, ext: nil, directory_separator:
|
|
32
|
+
def file_name(legacy_dir = NOT_GIVEN, legacy_name = NOT_GIVEN, legacy_ext = NOT_GIVEN, legacy_directory_separator = NOT_GIVEN, dir: nil, name: nil, ext: nil, directory_separator: ::File::Separator)
|
|
33
33
|
# rubocop:enable Metrics/ParameterLists
|
|
34
34
|
warn_for_deprecated_arguments do |keywords|
|
|
35
35
|
keywords << :dir if legacy_dir != NOT_GIVEN
|
|
@@ -4,8 +4,29 @@ module Faker
|
|
|
4
4
|
class Fillmurray < Base
|
|
5
5
|
class << self
|
|
6
6
|
# rubocop:disable Metrics/ParameterLists
|
|
7
|
+
|
|
8
|
+
##
|
|
9
|
+
# Produces the URL of an image from Fill Murray, a site which hosts
|
|
10
|
+
# exclusively photographs of actor Bill Murray.
|
|
11
|
+
#
|
|
12
|
+
# @param grayscale [Boolean] Whether to return a grayscale image.
|
|
13
|
+
# @param width [Integer] The iamage width.
|
|
14
|
+
# @param height [Integer] The image height.
|
|
15
|
+
# @return [String]
|
|
16
|
+
#
|
|
17
|
+
# @example
|
|
18
|
+
# Faker::Fillmurray.image #=> "https://www.fillmurray.com/300/300"
|
|
19
|
+
#
|
|
20
|
+
# @example
|
|
21
|
+
# Faker::Fillmurray.image(grayscale: true)
|
|
22
|
+
# #=> "https://fillmurray.com/g/300/300"
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
# Faker::Fillmurray.image(grayscale: false, width: 200, height: 400)
|
|
26
|
+
# #=> "https://fillmurray.com/200/400"
|
|
27
|
+
#
|
|
28
|
+
# @faker.version 1.7.1
|
|
7
29
|
def image(legacy_grayscale = NOT_GIVEN, legacy_width = NOT_GIVEN, legacy_height = NOT_GIVEN, grayscale: false, width: 200, height: 200)
|
|
8
|
-
# rubocop:enable Metrics/ParameterLists
|
|
9
30
|
warn_for_deprecated_arguments do |keywords|
|
|
10
31
|
keywords << :grayscale if legacy_grayscale != NOT_GIVEN
|
|
11
32
|
keywords << :width if legacy_width != NOT_GIVEN
|
|
@@ -18,6 +39,7 @@ module Faker
|
|
|
18
39
|
|
|
19
40
|
"https://www.fillmurray.com#{'/g' if grayscale == true}/#{width}/#{height}"
|
|
20
41
|
end
|
|
42
|
+
# rubocop:enable Metrics/ParameterLists
|
|
21
43
|
end
|
|
22
44
|
end
|
|
23
45
|
end
|