faker 2.7.0 → 2.8.1

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.
@@ -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
@@ -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
@@ -5,42 +5,106 @@ module Faker
5
5
  flexible :food
6
6
 
7
7
  class << self
8
- # Retrieves a typical dish from each country
8
+ ##
9
+ # Retrieves a typical dish from each country.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Food.dish #=> "Feijoada"
15
+ #
16
+ # @faker.version 1.8.0
9
17
  def dish
10
18
  fetch('food.dish')
11
19
  end
12
20
 
21
+ ##
13
22
  # Retrieves a description about some dish
23
+ #
24
+ # @return [String]
25
+ #
26
+ # @example
27
+ # Faker::Food.description #=> "Breaded fried chicken with waffles. Served with maple syrup."
28
+ #
29
+ # @faker.version 1.9.0
14
30
  def description
15
31
  fetch('food.descriptions')
16
32
  end
17
33
 
34
+ ##
18
35
  # Retrieves an ingredient
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example
40
+ # Faker::Food.ingredient #=> "Olives"
41
+ #
42
+ # @faker.version 1.7.0
19
43
  def ingredient
20
44
  fetch('food.ingredients')
21
45
  end
22
46
 
47
+ ##
23
48
  # Retrieves a fruit
49
+ #
50
+ # @return [String]
51
+ #
52
+ # @example
53
+ # Faker::Food.fruits #=> "Papaya"
54
+ #
55
+ # @faker.version 1.9.0
24
56
  def fruits
25
57
  fetch('food.fruits')
26
58
  end
27
59
 
60
+ ##
28
61
  # Retrieves a vegetable
62
+ #
63
+ # @return [String]
64
+ #
65
+ # @example
66
+ # Faker::Food.vegetables #=> "Broccolini"
67
+ #
68
+ # @faker.version 1.9.0
29
69
  def vegetables
30
70
  fetch('food.vegetables')
31
71
  end
32
72
 
73
+ ##
33
74
  # Retrieves some random spice
75
+ #
76
+ # @return [String]
77
+ #
78
+ # @example
79
+ # Faker::Food.spice #=> "Garlic Chips"
80
+ #
81
+ # @faker.version 1.7.0
34
82
  def spice
35
83
  fetch('food.spices')
36
84
  end
37
85
 
86
+ ##
38
87
  # Retrieves cooking measures
88
+ #
89
+ # @return [String]
90
+ #
91
+ # @example
92
+ # Faker::Food.measurement #=> "1/3"
93
+ #
94
+ # @faker.version 1.7.0
39
95
  def measurement
40
96
  fetch('food.measurement_sizes') + ' ' + fetch('food.measurements')
41
97
  end
42
98
 
99
+ ##
43
100
  # Retrieves metric mesurements
101
+ #
102
+ # @return [String]
103
+ #
104
+ # @example
105
+ # Faker::Food.metric_measurement #=> "centiliter"
106
+ #
107
+ # @faker.version 1.8.3
44
108
  def metric_measurement
45
109
  fetch('food.metric_measurements')
46
110
  end
@@ -3,16 +3,16 @@
3
3
  module Faker
4
4
  class Internet < Base
5
5
  class << self
6
- def email(legacy_name = NOT_GIVEN, legacy_separators = NOT_GIVEN, name: nil, separators: nil)
6
+ def email(legacy_name = NOT_GIVEN, legacy_separators = NOT_GIVEN, name: nil, separators: nil, domain: nil)
7
7
  warn_for_deprecated_arguments do |keywords|
8
8
  keywords << :name if legacy_name != NOT_GIVEN
9
9
  keywords << :separators if legacy_separators != NOT_GIVEN
10
10
  end
11
11
 
12
12
  if separators
13
- [username(specifier: name, separators: separators), domain_name].join('@')
13
+ [username(specifier: name, separators: separators), domain_name(domain: domain)].join('@')
14
14
  else
15
- [username(specifier: name), domain_name].join('@')
15
+ [username(specifier: name), domain_name(domain: domain)].join('@')
16
16
  end
17
17
  end
18
18
 
@@ -135,15 +135,25 @@ module Faker
135
135
  temp
136
136
  end
137
137
 
138
- def domain_name(legacy_subdomain = NOT_GIVEN, subdomain: false)
138
+ def domain_name(legacy_subdomain = NOT_GIVEN, subdomain: false, domain: nil)
139
139
  warn_for_deprecated_arguments do |keywords|
140
140
  keywords << :subdomain if legacy_subdomain != NOT_GIVEN
141
141
  end
142
142
 
143
143
  with_locale(:en) do
144
- domain_elements = [Char.prepare(domain_word), domain_suffix]
145
- domain_elements.unshift(Char.prepare(domain_word)) if subdomain
146
- domain_elements.join('.')
144
+ if domain
145
+ domain
146
+ .split('.')
147
+ .map { |domain_part| Char.prepare(domain_part) }
148
+ .tap do |domain_elements|
149
+ domain_elements << domain_suffix if domain_elements.length < 2
150
+ domain_elements.unshift(Char.prepare(domain_word)) if subdomain && domain_elements.length < 3
151
+ end.join('.')
152
+ else
153
+ [domain_word, domain_suffix].tap do |domain_elements|
154
+ domain_elements.unshift(Char.prepare(domain_word)) if subdomain
155
+ end.join('.')
156
+ end
147
157
  end
148
158
  end
149
159
 
@@ -3,26 +3,80 @@
3
3
  module Faker
4
4
  class Kpop < Base
5
5
  class << self
6
+ ##
7
+ # Produces the name of a 1990's 'OG' K-Pop group.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::Kpop.i_groups #=> "Seo Taiji and Boys"
13
+ #
14
+ # @faker.version 1.8.5
6
15
  def i_groups
7
16
  fetch('kpop.i_groups')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces the name of a 2000's K-Pop group.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::Kpop.ii_groups #=> "Girls' Generation"
26
+ #
27
+ # @faker.version 1.8.5
10
28
  def ii_groups
11
29
  fetch('kpop.ii_groups')
12
30
  end
13
31
 
32
+ ##
33
+ # Produces the name of a 2010's K-Pop group.
34
+ #
35
+ # @return [String]
36
+ #
37
+ # @example
38
+ # Faker::Kpop.iii_groups #=> "Trouble Maker"
39
+ #
40
+ # @faker.version 1.8.5
14
41
  def iii_groups
15
42
  fetch('kpop.iii_groups')
16
43
  end
17
44
 
45
+ ##
46
+ # Produces the name of a K-Pop girl group.
47
+ #
48
+ # @return [String]
49
+ #
50
+ # @example
51
+ # Faker::Kpop.girl_groups #=> "2NE1"
52
+ #
53
+ # @faker.version 1.8.5
18
54
  def girl_groups
19
55
  fetch('kpop.girl_groups')
20
56
  end
21
57
 
58
+ ##
59
+ # Produces the name of a K-Pop boy band.
60
+ #
61
+ # @return [String]
62
+ #
63
+ # @example
64
+ # Faker::Kpop.boy_bands #=> "Exo"
65
+ #
66
+ # @faker.version 1.8.5
22
67
  def boy_bands
23
68
  fetch('kpop.boy_bands')
24
69
  end
25
70
 
71
+ ##
72
+ # Produces the name of a solo K-Pop artist.
73
+ #
74
+ # @return [String]
75
+ #
76
+ # @example
77
+ # Faker::Kpop.solo #=> "T.O.P"
78
+ #
79
+ # @faker.version 1.8.5
26
80
  def solo
27
81
  fetch('kpop.solo')
28
82
  end
@@ -5,6 +5,15 @@ module Faker
5
5
  flexible :relationship
6
6
 
7
7
  class << self
8
+ ##
9
+ # Produces a random family relationship.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Relationship.familial #=> "Grandfather"
15
+ #
16
+ # @faker.version 1.9.2
8
17
  def familial(legacy_connection = NOT_GIVEN, connection: nil)
9
18
  warn_for_deprecated_arguments do |keywords|
10
19
  keywords << :connection if legacy_connection != NOT_GIVEN
@@ -26,18 +35,54 @@ module Faker
26
35
  fetch('relationship.familial.' + connection)
27
36
  end
28
37
 
38
+ ##
39
+ # Produces a random in-law relationship.
40
+ #
41
+ # @return [String]
42
+ #
43
+ # @example
44
+ # Faker::Relationship.in_law #=> "Brother-in-law"
45
+ #
46
+ # @faker.version 1.9.2
29
47
  def in_law
30
48
  fetch('relationship.in_law')
31
49
  end
32
50
 
51
+ ##
52
+ # Produces a random spouse relationship.
53
+ #
54
+ # @return [String]
55
+ #
56
+ # @example
57
+ # Faker::Relationship.spouse #=> "Husband"
58
+ #
59
+ # @faker.version 1.9.2
33
60
  def spouse
34
61
  fetch('relationship.spouse')
35
62
  end
36
63
 
64
+ ##
65
+ # Produces a random parent relationship.
66
+ #
67
+ # @return [String]
68
+ #
69
+ # @example
70
+ # Faker::Relationship.parent #=> "Father"
71
+ #
72
+ # @faker.version 1.9.2
37
73
  def parent
38
74
  fetch('relationship.parent')
39
75
  end
40
76
 
77
+ ##
78
+ # Produces a random sibling relationship.
79
+ #
80
+ # @return [String]
81
+ #
82
+ # @example
83
+ # Faker::Relationship.sibling #=> "Sister"
84
+ #
85
+ # @faker.version 1.9.2
41
86
  def sibling
42
87
  fetch('relationship.sibling')
43
88
  end
@@ -3,59 +3,186 @@
3
3
  module Faker
4
4
  class Space < Base
5
5
  flexible :space
6
+
6
7
  class << self
8
+ ##
9
+ # Produces the name of a planet.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Space.planet #=> "Venus"
15
+ #
16
+ # @faker.version 1.6.4
7
17
  def planet
8
18
  fetch('space.planet')
9
19
  end
10
20
 
21
+ ##
22
+ # Produces the name of a moon.
23
+ #
24
+ # @return [String]
25
+ #
26
+ # @example
27
+ # Faker::Space.moon #=> "Europa"
28
+ #
29
+ # @faker.version 1.6.4
11
30
  def moon
12
31
  fetch('space.moon')
13
32
  end
14
33
 
34
+ ##
35
+ # Produces the name of a galaxy.
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example
40
+ # Faker::Space.galaxy #=> "Andromeda"
41
+ #
42
+ # @faker.version 1.6.4
15
43
  def galaxy
16
44
  fetch('space.galaxy')
17
45
  end
18
46
 
47
+ ##
48
+ # Produces the name of a nebula.
49
+ #
50
+ # @return [String]
51
+ #
52
+ # @example
53
+ # Faker::Space.nebula #=> "Triffid Nebula"
54
+ #
55
+ # @faker.version 1.6.4
19
56
  def nebula
20
57
  fetch('space.nebula')
21
58
  end
22
59
 
60
+ ##
61
+ # Produces the name of a star cluster.
62
+ #
63
+ # @return [String]
64
+ #
65
+ # @example
66
+ # Faker::Space.star_cluster #=> "Messier 70"
67
+ #
68
+ # @faker.version 1.6.4
23
69
  def star_cluster
24
70
  fetch('space.star_cluster')
25
71
  end
26
72
 
73
+ ##
74
+ # Produces the name of a constellation.
75
+ #
76
+ # @return [String]
77
+ #
78
+ # @example
79
+ # Faker::Space.constellation #=> "Orion"
80
+ #
81
+ # @faker.version 1.6.4
27
82
  def constellation
28
83
  fetch('space.constellation')
29
84
  end
30
85
 
86
+ ##
87
+ # Produces the name of a star.
88
+ #
89
+ # @return [String]
90
+ #
91
+ # @example
92
+ # Faker::Space.star #=> "Proxima Centauri"
93
+ #
94
+ # @faker.version 1.6.4
31
95
  def star
32
96
  fetch('space.star')
33
97
  end
34
98
 
99
+ ##
100
+ # Produces the name of a space agency.
101
+ #
102
+ # @return [String]
103
+ #
104
+ # @example
105
+ # Faker::Space.agency #=> "Japan Aerospace Exploration Agency"
106
+ #
107
+ # @faker.version 1.6.4
35
108
  def agency
36
109
  fetch('space.agency')
37
110
  end
38
111
 
112
+ ##
113
+ # Produces a space agency abbreviation.
114
+ #
115
+ # @return [String]
116
+ #
117
+ # @example
118
+ # Faker::Space.agency_abv #=> "NASA"
119
+ #
120
+ # @faker.version 1.6.4
39
121
  def agency_abv
40
122
  fetch('space.agency_abv')
41
123
  end
42
124
 
125
+ ##
126
+ # Produces the name of a NASA spacecraft.
127
+ #
128
+ # @return [String]
129
+ #
130
+ # @example
131
+ # Faker::Space.nasa_space_craft #=> "Endeavour"
132
+ #
133
+ # @faker.version 1.6.4
43
134
  def nasa_space_craft
44
135
  fetch('space.nasa_space_craft')
45
136
  end
46
137
 
138
+ ##
139
+ # Produces the name of a space company.
140
+ #
141
+ # @return [String]
142
+ #
143
+ # @example
144
+ # Faker::Space.company #=> "SpaceX"
145
+ #
146
+ # @faker.version 1.6.4
47
147
  def company
48
148
  fetch('space.company')
49
149
  end
50
150
 
151
+ ##
152
+ # Produces a distance measurement.
153
+ #
154
+ # @return [String]
155
+ #
156
+ # @example
157
+ # Faker::Space.distance_measurement #=> "15 parsecs"
158
+ #
159
+ # @faker.version 1.6.4
51
160
  def distance_measurement
52
161
  rand(10..100).to_s + ' ' + fetch('space.distance_measurement')
53
162
  end
54
163
 
164
+ ##
165
+ # Produces the name of a meteorite.
166
+ #
167
+ # @return [String]
168
+ #
169
+ # @example
170
+ # Faker::Space.meteorite #=> "Ensisheim"
171
+ #
172
+ # @faker.version 1.7.0
55
173
  def meteorite
56
174
  fetch('space.meteorite')
57
175
  end
58
176
 
177
+ ##
178
+ # Produces the name of a launch vehicle.
179
+ #
180
+ # @return [String]
181
+ #
182
+ # @example
183
+ # Faker::Space.launch_vehicle #=> "Saturn IV"
184
+ #
185
+ # @faker.version 1.9.0
59
186
  def launch_vehicle
60
187
  fetch('space.launch_vehicle')
61
188
  end