faker 2.8.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.
@@ -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
@@ -141,10 +141,19 @@ module Faker
141
141
  end
142
142
 
143
143
  with_locale(:en) do
144
- given_domain_word = domain || domain_word
145
- domain_elements = [Char.prepare(given_domain_word), domain_suffix]
146
- domain_elements.unshift(Char.prepare(given_domain_word)) if subdomain
147
- 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
148
157
  end
149
158
  end
150
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
@@ -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
@@ -5,22 +5,67 @@ module Faker
5
5
  flexible :team
6
6
 
7
7
  class << self
8
+ ##
9
+ # Produces a team name from a state and a creature.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Team.name #=> "Oregon vixens"
15
+ #
16
+ # @faker.version 1.3.0
8
17
  def name
9
18
  parse('team.name')
10
19
  end
11
20
 
21
+ ##
22
+ # Produces a team creature.
23
+ #
24
+ # @return [String]
25
+ #
26
+ # @example
27
+ # Faker::Team.creature #=> "geese"
28
+ #
29
+ # @faker.version 1.3.0
12
30
  def creature
13
31
  fetch('team.creature')
14
32
  end
15
33
 
34
+ ##
35
+ # Produces a team state.
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example
40
+ # Faker::Team.state #=> "Oregon"
41
+ #
42
+ # @faker.version 1.3.0
16
43
  def state
17
44
  fetch('address.state')
18
45
  end
19
46
 
47
+ ##
48
+ # Produces a team sport.
49
+ #
50
+ # @return [String]
51
+ #
52
+ # @example
53
+ # Faker::Team.sport #=> "Lacrosse"
54
+ #
55
+ # @faker.version 1.5.0
20
56
  def sport
21
57
  fetch('team.sport')
22
58
  end
23
59
 
60
+ ##
61
+ # Produces the name of a team mascot.
62
+ #
63
+ # @return [String]
64
+ #
65
+ # @example
66
+ # Faker::Team.mascot #=> "Hugo"
67
+ #
68
+ # @faker.version 1.8.1
24
69
  def mascot
25
70
  fetch('team.mascot')
26
71
  end