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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6cacd4170df63c267efee25b7e575509b1ff16528a143a916e90c6381bd48a8b
4
- data.tar.gz: 7165d20574c9994f703d6c5b473b42125c27421754c7e387e3d34d5c174307e7
3
+ metadata.gz: 76e19dcb7a0fa3703ab5ad3864a973a9bb4ce8d18ca75947ebc8300a3f29fbcb
4
+ data.tar.gz: 7a171e80faa3db8686d8e0f9e2d4e21f77322268161aebfbae5b58b14139a795
5
5
  SHA512:
6
- metadata.gz: 5fc24fc4438f8737f09597f0f8b7be162f5d609c3e8b7799423eae173635d0762688f51e4790e915913e6e263ba9dbb45f6f02829f4ff5cf1fab724e4118acbd
7
- data.tar.gz: ca6e471b882bca1b98ab777d6dfdf8798f4cb061d4c98781a8e93869d979ba8eefdf98541387fa309d745cd67fcb5a91b7adc8a23f647da3c8a705291b5f1989
6
+ metadata.gz: 8f161b394abfccf7ca9122d8bc6d8957f63f8c0f9c5d3772c31ed898dfc50fb50b13b0da01289a67ff89904ec3cf4a16e514b568a9ef69a07f48e27e4e1e7da5
7
+ data.tar.gz: 00f2bcd1ae3821b113e1b375a1ceb0baa5657aad695f9f7fb7569f4bc74a65cacec2096535664a73f6a0840554613e7e11111dcce6d50fcc126e6c46199b930b
@@ -1,5 +1,73 @@
1
1
  # Change Log
2
2
 
3
+ ## [v2.8.1](https://github.com/faker-ruby/faker/tree/v2.8.1) (2019-12-06)
4
+
5
+ ## Bug/Fixes
6
+
7
+ - [PR #1846](https://github.com/faker-ruby/faker/pull/1846) Fix internet custom domain with suffix [@ngouy](https://github.com/ngouy)
8
+
9
+ ## Documentation
10
+
11
+ - [PR #1852](https://github.com/faker-ruby/faker/pull/1852) Add YARD docs for Faker::Business. [@connorshea](https://github.com/connorshea)
12
+ - [PR #1851](https://github.com/faker-ruby/faker/pull/1851) Add YARD docs for Faker::Crypto. [@connorshea](https://github.com/connorshea)
13
+ - [PR #1850](https://github.com/faker-ruby/faker/pull/1850) Add YARD docs for Faker::Kpop. [@connorshea](https://github.com/connorshea)
14
+ - [PR #1849](https://github.com/faker-ruby/faker/pull/1849) Add YARD docs for Faker::BossaNova. [@connorshea](https://github.com/connorshea)
15
+ - [PR #1848](https://github.com/faker-ruby/faker/pull/1848) Add YARD Docs for Faker::Demographic. [@connorshea](https://github.com/connorshea)
16
+ - [PR #1844](https://github.com/faker-ruby/faker/pull/1844) Fix yard doc in contribution [@vikas95prasad](https://github.com/vikas95prasad)
17
+ - [PR #1802](https://github.com/faker-ruby/faker/pull/1802) Add YARD doc for Faker::Food [@sap1enza](https://github.com/sap1enza)
18
+ - [PR #1766](https://github.com/faker-ruby/faker/pull/1766) Add YARD docs for Faker::Address [@connorshea](https://github.com/connorshea)
19
+
20
+ ## Refactoring
21
+
22
+ - [PR #1847](https://github.com/faker-ruby/faker/pull/1847) Makes minor refactors on Internet.domain_name method [@tiagofsilva](https://github.com/tiagofsilva)
23
+ - [PR #1772](https://github.com/faker-ruby/faker/pull/1848) Refactor Faker::Educator and add docs [@connorshea](https://github.com/connorshea)
24
+
25
+ ## Update local dependencies
26
+
27
+ - Update rubocop requirement from = 0.76.0 to = 0.77.0 (#1843)
28
+
29
+ ------------------------------------------------------------------------------
30
+
31
+ ## [v2.8.0](https://github.com/faker-ruby/faker/tree/v2.8.0) (2019-12-01)
32
+
33
+ ## Bug/Fixes
34
+
35
+ - [PR #1563](https://github.com/faker-ruby/faker/pull/1563)
36
+ Fix generating routing number [@psienko](https://github.com/psienko)
37
+
38
+ ## Chores
39
+
40
+ - [PR #1835](https://github.com/faker-ruby/faker/pull/1835)
41
+ Remove duplicate method description [@pacso](https://github.com/pacso)
42
+
43
+ ## Documentation
44
+
45
+ - [PR #1837](https://github.com/faker-ruby/faker/pull/1837)
46
+ docs: Internet #email, #domain do not control TLD [@olleolleolle](https://github.com/olleolleolle)
47
+ - [PR #1833](https://github.com/faker-ruby/faker/pull/1833) Explain safe_email method [@swrobel](https://github.com/swrobel)
48
+ - [PR #1810](https://github.com/faker-ruby/faker/pull/1810) Add yard docs for Faker::Coffee methods [@LuanGB](https://github.com/LuanGB)
49
+ - [PR #1803](https://github.com/faker-ruby/faker/pull/1803)
50
+ add YARD doc for Faker::Coin [@sap1enza](https://github.com/sap1enza) [@connorshea](https://github.com/connorshea)
51
+ - [PR #1799](https://github.com/faker-ruby/faker/pull/1799) Remove 'See below examples' for consistency [@DevUsmanGhani](https://github.com/DevUsmanGhani)
52
+ - [PR #1793](https://github.com/faker-ruby/faker/pull/1793) add Faker::Relationship YARD docs [@DevUsmanGhani](https://github.com/DevUsmanGhani)
53
+
54
+ ## Feature Request
55
+
56
+ - [PR #1808](https://github.com/faker-ruby/faker/pull/1808) Adds domain option for Internet email and domain_name methods [@tiagofsilva](https://github.com/tiagofsilva)
57
+
58
+ ## Update locales
59
+
60
+ - [PR #1841](https://github.com/faker-ruby/faker/pull/1841)
61
+ Fix strange result from `Lorem.word` in ja locale [@yujideveloper](https://github.com/yujideveloper)
62
+ - [PR #1839](https://github.com/faker-ruby/faker/pull/1839)
63
+ added new heroes, new maps and almost all of the quotes [@TCsTheMechanic](https://github.com/TCsTheMechanic)
64
+
65
+ ## Update local dependencies
66
+
67
+ - [PR #1831](https://github.com/faker-ruby/faker/pull/1831) Update rake requirement from = 13.0.0 to = 13.0.1 [@DevUsmanGhani](https://github.com/DevUsmanGhani)
68
+
69
+ ------------------------------------------------------------------------------
70
+
3
71
  ## [v2.7.0](https://github.com/faker-ruby/faker/tree/v2.7.0) (2019-11-01)
4
72
 
5
73
  This version:
@@ -5,6 +5,19 @@ module Faker
5
5
  flexible :address
6
6
 
7
7
  class << self
8
+ ##
9
+ # Produces the name of a city.
10
+ #
11
+ # @param options [Hash]
12
+ # @option with_state [Boolean] Whether to include the state name in the output.
13
+ # @return [String]
14
+ #
15
+ # @example
16
+ # Faker::Address.city #=> "Imogeneborough"
17
+ # Faker::Address.city(options: { with_state: true })
18
+ # #=> "Northfort, California"
19
+ #
20
+ # @faker.version 0.3.0
8
21
  def city(legacy_options = NOT_GIVEN, options: {})
9
22
  warn_for_deprecated_arguments do |keywords|
10
23
  keywords << :options if legacy_options != NOT_GIVEN
@@ -13,10 +26,29 @@ module Faker
13
26
  parse(options[:with_state] ? 'address.city_with_state' : 'address.city')
14
27
  end
15
28
 
29
+ ##
30
+ # Produces a street name.
31
+ #
32
+ # @return [String]
33
+ #
34
+ # @example
35
+ # Faker::Address.street_name #=> "Larkin Fork"
36
+ #
37
+ # @faker.version 0.3.0
16
38
  def street_name
17
39
  parse('address.street_name')
18
40
  end
19
41
 
42
+ ##
43
+ # Produces a street address.
44
+ #
45
+ # @param include_secondary [Boolean] Whether or not to include the secondary address.
46
+ # @return [String]
47
+ #
48
+ # @example
49
+ # Faker::Address.street_address #=> "282 Kevin Brook"
50
+ #
51
+ # @faker.version 0.3.0
20
52
  def street_address(legacy_include_secondary = NOT_GIVEN, include_secondary: false)
21
53
  warn_for_deprecated_arguments do |keywords|
22
54
  keywords << :include_secondary if legacy_include_secondary != NOT_GIVEN
@@ -25,18 +57,57 @@ module Faker
25
57
  numerify(parse('address.street_address') + (include_secondary ? ' ' + secondary_address : ''))
26
58
  end
27
59
 
60
+ ##
61
+ # Produces a secondary address.
62
+ #
63
+ # @return [String]
64
+ #
65
+ # @example
66
+ # Faker::Address.secondary_address #=> "Apt. 672"
67
+ #
68
+ # @faker.version 0.3.0
28
69
  def secondary_address
29
70
  bothify(fetch('address.secondary_address'))
30
71
  end
31
72
 
73
+ ##
74
+ # Produces a building number.
75
+ #
76
+ # @return [String]
77
+ #
78
+ # @example
79
+ # Faker::Address.building_number #=> "7304"
80
+ #
81
+ # @faker.version 0.3.0
32
82
  def building_number
33
83
  bothify(fetch('address.building_number'))
34
84
  end
35
85
 
86
+ ##
87
+ # Produces the name of a community.
88
+ #
89
+ # @return [String]
90
+ #
91
+ # @example
92
+ # Faker::Address.community #=> "University Crossing"
93
+ #
94
+ # @faker.version 1.8.0
36
95
  def community
37
96
  parse('address.community')
38
97
  end
39
98
 
99
+ ##
100
+ # Produces a Zip Code.
101
+ #
102
+ # @param state_abbreviation [String] an abbreviation for a state where the zip code should be located.
103
+ # @return [String]
104
+ #
105
+ # @example
106
+ # Faker::Address.zip_code #=> "58517"
107
+ # Faker::Address.zip_code #=> "23285-4905"
108
+ # Faker::Address.zip_code(state_abbreviation: 'CO') #=> "80011"
109
+ #
110
+ # @faker.version 0.3.0
40
111
  def zip_code(legacy_state_abbreviation = NOT_GIVEN, state_abbreviation: '')
41
112
  warn_for_deprecated_arguments do |keywords|
42
113
  keywords << :state_abbreviation if legacy_state_abbreviation != NOT_GIVEN
@@ -52,6 +123,15 @@ module Faker
52
123
  bothify(fetch('address.postcode_by_state.' + state_abbreviation))
53
124
  end
54
125
 
126
+ ##
127
+ # Produces the name of a time zone.
128
+ #
129
+ # @return [String]
130
+ #
131
+ # @example
132
+ # Faker::Address.time_zone #=> "Asia/Yakutsk"
133
+ #
134
+ # @faker.version 1.2.0
55
135
  def time_zone
56
136
  fetch('address.time_zone')
57
137
  end
@@ -59,30 +139,96 @@ module Faker
59
139
  alias zip zip_code
60
140
  alias postcode zip_code
61
141
 
142
+ ##
143
+ # Produces a street suffix.
144
+ #
145
+ # @return [String]
146
+ #
147
+ # @example
148
+ # Faker::Address.street_suffix #=> "Street"
149
+ #
150
+ # @faker.version 0.3.0
62
151
  def street_suffix
63
152
  fetch('address.street_suffix')
64
153
  end
65
154
 
155
+ ##
156
+ # Produces a city suffix.
157
+ #
158
+ # @return [String]
159
+ #
160
+ # @example
161
+ # Faker::Address.city_suffix #=> "fort"
162
+ #
163
+ # @faker.version 0.3.0
66
164
  def city_suffix
67
165
  fetch('address.city_suffix')
68
166
  end
69
167
 
168
+ ##
169
+ # Produces a city prefix.
170
+ #
171
+ # @return [String]
172
+ #
173
+ # @example
174
+ # Faker::Address.city_prefix #=> "Lake"
175
+ #
176
+ # @faker.version 0.3.0
70
177
  def city_prefix
71
178
  fetch('address.city_prefix')
72
179
  end
73
180
 
181
+ ##
182
+ # Produces a state abbreviation.
183
+ #
184
+ # @return [String]
185
+ #
186
+ # @example
187
+ # Faker::Address.state_abbr #=> "AP"
188
+ #
189
+ # @faker.version 0.3.0
74
190
  def state_abbr
75
191
  fetch('address.state_abbr')
76
192
  end
77
193
 
194
+ ##
195
+ # Produces the name of a state.
196
+ #
197
+ # @return [String]
198
+ #
199
+ # @example
200
+ # Faker::Address.state #=> "California"
201
+ #
202
+ # @faker.version 0.3.0
78
203
  def state
79
204
  fetch('address.state')
80
205
  end
81
206
 
207
+ ##
208
+ # Produces the name of a country.
209
+ #
210
+ # @return [String]
211
+ #
212
+ # @example
213
+ # Faker::Address.country #=> "French Guiana"
214
+ #
215
+ # @faker.version 0.3.0
82
216
  def country
83
217
  fetch('address.country')
84
218
  end
85
219
 
220
+ ##
221
+ # Produces a country by ISO country code. See the
222
+ # [List of ISO 3166 country codes](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes)
223
+ # on Wikipedia for a full list.
224
+ #
225
+ # @param code [String] An ISO country code.
226
+ # @return [String]
227
+ #
228
+ # @example
229
+ # Faker::Address.country_by_code(code: 'NL') #=> "Netherlands"
230
+ #
231
+ # @faker.version 1.9.2
86
232
  def country_by_code(legacy_code = NOT_GIVEN, code: 'US')
87
233
  warn_for_deprecated_arguments do |keywords|
88
234
  keywords << :code if legacy_code != NOT_GIVEN
@@ -91,6 +237,16 @@ module Faker
91
237
  fetch('address.country_by_code.' + code)
92
238
  end
93
239
 
240
+ ##
241
+ # Produces an ISO 3166 country code when given a country name.
242
+ #
243
+ # @param name [String] Country name in snake_case format.
244
+ # @return [String]
245
+ #
246
+ # @example
247
+ # Faker::Address.country_name_to_code(name: 'united_states') #=> "US"
248
+ #
249
+ # @faker.version 1.9.2
94
250
  def country_name_to_code(legacy_name = NOT_GIVEN, name: 'united_states')
95
251
  warn_for_deprecated_arguments do |keywords|
96
252
  keywords << :name if legacy_name != NOT_GIVEN
@@ -99,22 +255,68 @@ module Faker
99
255
  fetch('address.country_by_name.' + name)
100
256
  end
101
257
 
258
+ ##
259
+ # Produces an ISO 3166 country code.
260
+ #
261
+ # @return [String]
262
+ #
263
+ # @example
264
+ # Faker::Address.country_code #=> "IT"
265
+ #
266
+ # @faker.version 1.4.0
102
267
  def country_code
103
268
  fetch('address.country_code')
104
269
  end
105
270
 
271
+ ##
272
+ # Produces a long (alpha-3) ISO 3166 country code.
273
+ #
274
+ # @return [String]
275
+ #
276
+ # @example
277
+ # Faker::Address.country_code_long #=> "ITA"
278
+ #
279
+ # @faker.version 0.3.0
106
280
  def country_code_long
107
281
  fetch('address.country_code_long')
108
282
  end
109
283
 
284
+ ##
285
+ # Produces a latitude.
286
+ #
287
+ # @return [Float]
288
+ #
289
+ # @example
290
+ # Faker::Address.latitude #=> -58.17256227443719
291
+ #
292
+ # @faker.version 1.0.0
110
293
  def latitude
111
294
  ((rand * 180) - 90).to_f
112
295
  end
113
296
 
297
+ ##
298
+ # Produces a longitude.
299
+ #
300
+ # @return [Float]
301
+ #
302
+ # @example
303
+ # Faker::Address.longitude #=> -156.65548382095133
304
+ #
305
+ # @faker.version 1.0.0
114
306
  def longitude
115
307
  ((rand * 360) - 180).to_f
116
308
  end
117
309
 
310
+ ##
311
+ # Produces a full address.
312
+ #
313
+ # @return [String]
314
+ #
315
+ # @example
316
+ # Faker::Address.full_address
317
+ # #=> "282 Kevin Brook, Imogeneborough, CA 58517"
318
+ #
319
+ # @faker.version 0.3.0
118
320
  def full_address
119
321
  parse('address.full_address')
120
322
  end
@@ -3,18 +3,54 @@
3
3
  module Faker
4
4
  class Ancient < Base
5
5
  class << self
6
+ ##
7
+ # Produces a god from ancient mythology.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::Ancient.god #=> "Zeus"
13
+ #
14
+ # @faker.version 1.7.0
6
15
  def god
7
16
  fetch('ancient.god')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces a primordial from ancient mythology.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::Ancient.primordial #=> "Gaia"
26
+ #
27
+ # @faker.version 1.7.0
10
28
  def primordial
11
29
  fetch('ancient.primordial')
12
30
  end
13
31
 
32
+ ##
33
+ # Produces a titan from ancient mythology.
34
+ #
35
+ # @return [String]
36
+ #
37
+ # @example
38
+ # Faker::Ancient.titan #=> "Atlas"
39
+ #
40
+ # @faker.version 1.7.0
14
41
  def titan
15
42
  fetch('ancient.titan')
16
43
  end
17
44
 
45
+ ##
46
+ # Produces a hero from ancient mythology.
47
+ #
48
+ # @return [String]
49
+ #
50
+ # @example
51
+ # Faker::Ancient.hero #=> "Achilles"
52
+ #
53
+ # @faker.version 1.7.0
18
54
  def hero
19
55
  fetch('ancient.hero')
20
56
  end
@@ -58,8 +58,11 @@ module Faker
58
58
 
59
59
  def checksum(num_string)
60
60
  num_array = num_string.split('').map(&:to_i)
61
- digit = (7 * (num_array[0] + num_array[3] + num_array[6]) + 3 * (num_array[1] + num_array[4] + num_array[7]) + 9 * (num_array[2] + num_array[5])) % 10
62
- digit == num_array[8]
61
+ (
62
+ 7 * (num_array[0] + num_array[3] + num_array[6]) +
63
+ 3 * (num_array[1] + num_array[4] + num_array[7]) +
64
+ 9 * (num_array[2] + num_array[5])
65
+ ) % 10
63
66
  end
64
67
 
65
68
  def compile_routing_number
@@ -85,12 +88,15 @@ module Faker
85
88
  end
86
89
 
87
90
  def valid_routing_number
88
- for _ in 0..50
89
- micr = compile_routing_number
91
+ routing_number = compile_routing_number
92
+ checksum = checksum(routing_number)
93
+ return routing_number if valid_checksum?(routing_number, checksum)
90
94
 
91
- break if checksum(micr)
92
- end
93
- micr
95
+ routing_number[0..7] + checksum.to_s
96
+ end
97
+
98
+ def valid_checksum?(routing_number, checksum)
99
+ routing_number[8].to_i == checksum
94
100
  end
95
101
 
96
102
  def compile_fraction(routing_num)