faker 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -0
- data/lib/faker.rb +34 -0
- data/lib/faker/blockchain/tezos.rb +6 -6
- data/lib/faker/books/dune.rb +4 -6
- data/lib/faker/books/lovecraft.rb +17 -33
- data/lib/faker/default/address.rb +10 -15
- data/lib/faker/default/alphanumeric.rb +6 -12
- data/lib/faker/default/app.rb +4 -11
- data/lib/faker/default/avatar.rb +6 -19
- data/lib/faker/default/bank.rb +4 -6
- data/lib/faker/default/boolean.rb +2 -3
- data/lib/faker/default/chile_rut.rb +6 -14
- data/lib/faker/default/code.rb +7 -13
- data/lib/faker/default/commerce.rb +8 -17
- data/lib/faker/default/company.rb +4 -6
- data/lib/faker/default/crypto_coin.rb +6 -9
- data/lib/faker/default/date.rb +17 -28
- data/lib/faker/default/demographic.rb +2 -3
- data/lib/faker/default/driving_licence.rb +5 -15
- data/lib/faker/default/file.rb +9 -26
- data/lib/faker/default/fillmurray.rb +4 -11
- data/lib/faker/default/finance.rb +2 -3
- data/lib/faker/default/hipster.rb +21 -54
- data/lib/faker/default/id_number.rb +5 -7
- data/lib/faker/default/internet.rb +30 -65
- data/lib/faker/default/invoice.rb +7 -13
- data/lib/faker/default/json.rb +9 -16
- data/lib/faker/default/lorem.rb +30 -70
- data/lib/faker/default/lorem_flickr.rb +17 -48
- data/lib/faker/default/lorem_pixel.rb +7 -23
- data/lib/faker/default/markdown.rb +3 -7
- data/lib/faker/default/measurement.rb +16 -24
- data/lib/faker/default/name.rb +2 -3
- data/lib/faker/default/nhs.rb +2 -3
- data/lib/faker/default/number.rb +25 -50
- data/lib/faker/default/omniauth.rb +25 -63
- data/lib/faker/default/phone_number.rb +2 -3
- data/lib/faker/default/placeholdit.rb +6 -19
- data/lib/faker/default/relationship.rb +2 -3
- data/lib/faker/default/source.rb +8 -12
- data/lib/faker/default/string.rb +2 -3
- data/lib/faker/default/stripe.rb +8 -12
- data/lib/faker/default/time.rb +17 -48
- data/lib/faker/default/twitter.rb +23 -32
- data/lib/faker/default/types.rb +12 -23
- data/lib/faker/default/vehicle.rb +8 -14
- data/lib/faker/default/world_cup.rb +5 -10
- data/lib/faker/games/dota.rb +2 -3
- data/lib/faker/movies/star_wars.rb +3 -6
- data/lib/faker/version.rb +1 -1
- data/lib/locales/en/science.yml +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c140b70507d530616f9c4ab8253cde32bab8bd7489eec025ebc3e0d81027e0be
|
4
|
+
data.tar.gz: b752dafd7f9a6816b811e7b886b0097389fb12f2bb4ff714babcab5215c1528b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01f9d799d52e5b502b21ba569a046f078c45d59e8f0c82e09fa5f79b13bcbf0633a2150d2017623c6ad50256536e94273fc30b59c1835fca639ca4772cf85839
|
7
|
+
data.tar.gz: 4f0fc396d99449791e7edf1ff9013842617e6ecd4c8d153574a773b81041801750c02fb3974c6e05cdfc4429c26bc54528e00a509fa0b8dfd3d788fc5ff0e335
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v2.2.2](https://github.com/faker-ruby/faker/tree/v2.2.2) (2019-05-09)
|
4
|
+
|
5
|
+
## Bug/Fixes
|
6
|
+
|
7
|
+
- [PR #1717](https://github.com/faker-ruby/faker/pull/1717) Fix ambiguity in element_symbol field [@psibi](https://github.com/psibi)
|
8
|
+
|
9
|
+
## Chores
|
10
|
+
|
11
|
+
- [PR #1724](https://github.com/faker-ruby/faker/pull/1724) Include rubocop-faker autocorrect in deprecation [@koic](https://github.com/koic)
|
12
|
+
|
13
|
+
## Documentation
|
14
|
+
|
15
|
+
- [PR #1726](https://github.com/faker-ruby/faker/pull/1726) Include 2.x breaking return value change in changelog [@zorab47](https://github.com/zorab47)
|
16
|
+
- [PR #1722](https://github.com/faker-ruby/faker/pull/1722) Fix examples in the Dota docs [@bzf](https://github.com/bzf)
|
17
|
+
|
18
|
+
## Update local dependencies
|
19
|
+
|
20
|
+
The following development dependencies were updated:
|
21
|
+
- rake requirement from = 12.3.1 to = 12.3.3 (#1719)
|
22
|
+
- rubocop requirement from = 0.59.1 to = 0.74.0 (#1721)
|
23
|
+
- simplecov requirement from = 0.16.1 to = 0.17.0 (#1718)
|
24
|
+
|
25
|
+
------------------------------------------------------------------------------
|
26
|
+
|
3
27
|
## [v2.2.1](https://github.com/faker-ruby/faker/tree/v2.2.1) (2019-30-08)
|
4
28
|
|
5
29
|
## Bug/Fixes
|
@@ -202,6 +226,10 @@ Version 2 has several `breaking changes`. We replaced positional arguments with
|
|
202
226
|
- `Faker::WorldCup.roster(country = nil, type = nil)` becomes `Faker::WorldCup.roster(country: nil, type: nil)`
|
203
227
|
- `Faker::Movies::StarWars.quote(character = nil)` becomes `Faker::Movies::StarWars.quote(character: nil)`
|
204
228
|
|
229
|
+
Additionally the following methods changed return values:
|
230
|
+
|
231
|
+
- `Faker::Number.number` now returns `Numeric` instead of `String` (see [PR #510](https://github.com/faker-ruby/faker/pull/510))
|
232
|
+
|
205
233
|
### Bug/Fixes
|
206
234
|
|
207
235
|
- [PR #1660](https://github.com/stympy/faker/pull/1660) Update FillMurray Links To Include www [@RaymondFallon](https://github.com/RaymondFallon)
|
data/lib/faker.rb
CHANGED
@@ -251,6 +251,40 @@ module Faker
|
|
251
251
|
|
252
252
|
private
|
253
253
|
|
254
|
+
def warn_for_deprecated_arguments
|
255
|
+
keywords = []
|
256
|
+
yield(keywords)
|
257
|
+
|
258
|
+
return if keywords.empty?
|
259
|
+
|
260
|
+
method_name = caller.first.match(/`(?<method_name>.*)'/)[:method_name]
|
261
|
+
|
262
|
+
keywords.each.with_index(1) do |keyword, index|
|
263
|
+
i = case index
|
264
|
+
when 1 then '1st'
|
265
|
+
when 2 then '2nd'
|
266
|
+
when 3 then '3rd'
|
267
|
+
else "#{index}th"
|
268
|
+
end
|
269
|
+
|
270
|
+
warn_with_uplevel(<<~MSG, uplevel: 5)
|
271
|
+
Passing `#{keyword}` with the #{i} argument of `#{method_name}` is deprecated. Use keyword argument like `#{method_name}(#{keyword}: ...)` instead.
|
272
|
+
MSG
|
273
|
+
end
|
274
|
+
|
275
|
+
warn(<<~MSG)
|
276
|
+
|
277
|
+
To automatically update from positional arguments to keyword arguments,
|
278
|
+
install rubocop-faker and run:
|
279
|
+
|
280
|
+
rubocop \\
|
281
|
+
--require rubocop-faker \\
|
282
|
+
--only Faker/DeprecatedArguments \\
|
283
|
+
--auto-correct
|
284
|
+
|
285
|
+
MSG
|
286
|
+
end
|
287
|
+
|
254
288
|
# Workaround for emulating `warn '...', uplevel: 1` in Ruby 2.4 or lower.
|
255
289
|
def warn_with_uplevel(message, uplevel: 1)
|
256
290
|
at = parse_caller(caller[uplevel]).join(':')
|
@@ -8,13 +8,13 @@ module Faker
|
|
8
8
|
class Tezos < Base
|
9
9
|
class << self
|
10
10
|
PREFIXES = {
|
11
|
-
tz1:
|
12
|
-
KT1:
|
13
|
-
edpk:
|
14
|
-
edsk:
|
11
|
+
tz1: [6, 161, 159],
|
12
|
+
KT1: [2, 90, 121],
|
13
|
+
edpk: [13, 15, 37, 217],
|
14
|
+
edsk: [13, 15, 58, 7],
|
15
15
|
edsig: [9, 245, 205, 134, 18],
|
16
|
-
B:
|
17
|
-
o:
|
16
|
+
B: [1, 52],
|
17
|
+
o: [5, 116]
|
18
18
|
}.freeze
|
19
19
|
|
20
20
|
def account
|
data/lib/faker/books/dune.rb
CHANGED
@@ -20,9 +20,8 @@ module Faker
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def quote(legacy_character = NOT_GIVEN, character: nil)
|
23
|
-
|
24
|
-
|
25
|
-
character = legacy_character
|
23
|
+
warn_for_deprecated_arguments do |keywords|
|
24
|
+
keywords << :character if legacy_character != NOT_GIVEN
|
26
25
|
end
|
27
26
|
|
28
27
|
quoted_characters = translate('faker.dune.quotes').keys
|
@@ -42,9 +41,8 @@ module Faker
|
|
42
41
|
end
|
43
42
|
|
44
43
|
def saying(legacy_source = NOT_GIVEN, source: nil)
|
45
|
-
|
46
|
-
|
47
|
-
source = legacy_source
|
44
|
+
warn_for_deprecated_arguments do |keywords|
|
45
|
+
keywords << :source if legacy_source != NOT_GIVEN
|
48
46
|
end
|
49
47
|
|
50
48
|
sourced_sayings = translate('faker.dune.sayings').keys
|
@@ -9,9 +9,8 @@ module Faker
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def fhtagn(legacy_number = NOT_GIVEN, number: 1)
|
12
|
-
|
13
|
-
|
14
|
-
number = legacy_number
|
12
|
+
warn_for_deprecated_arguments do |keywords|
|
13
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
15
14
|
end
|
16
15
|
|
17
16
|
Array.new(number) { fetch('lovecraft.fhtagn') }.join('. ')
|
@@ -26,13 +25,9 @@ module Faker
|
|
26
25
|
end
|
27
26
|
|
28
27
|
def sentence(legacy_word_count = NOT_GIVEN, legacy_random_words_to_add = NOT_GIVEN, word_count: 4, random_words_to_add: 6)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
if legacy_random_words_to_add != NOT_GIVEN
|
34
|
-
warn_with_uplevel 'Passing `random_words_to_add` with the 2nd argument of `Lovecraft.sentence` is deprecated. Use keyword argument like `Lovecraft.sentence(random_words_to_add: ...)` instead.', uplevel: 1
|
35
|
-
random_words_to_add = legacy_random_words_to_add
|
28
|
+
warn_for_deprecated_arguments do |keywords|
|
29
|
+
keywords << :word_count if legacy_word_count != NOT_GIVEN
|
30
|
+
keywords << :random_words_to_add if legacy_random_words_to_add != NOT_GIVEN
|
36
31
|
end
|
37
32
|
|
38
33
|
words(number: word_count + rand(random_words_to_add.to_i).to_i, spaces_allowed: true).join(' ').capitalize + '.'
|
@@ -44,13 +39,9 @@ module Faker
|
|
44
39
|
end
|
45
40
|
|
46
41
|
def words(legacy_number = NOT_GIVEN, legacy_spaces_allowed = NOT_GIVEN, number: 3, spaces_allowed: false)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
if legacy_spaces_allowed != NOT_GIVEN
|
52
|
-
warn_with_uplevel 'Passing `spaces_allowed` with the 2nd argument of `Lovecraft.words` is deprecated. Use keyword argument like `Lovecraft.words(spaces_allowed: ...)` instead.', uplevel: 1
|
53
|
-
spaces_allowed = legacy_spaces_allowed
|
42
|
+
warn_for_deprecated_arguments do |keywords|
|
43
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
44
|
+
keywords << :spaces_allowed if legacy_spaces_allowed != NOT_GIVEN
|
54
45
|
end
|
55
46
|
|
56
47
|
resolved_num = resolve(number)
|
@@ -64,9 +55,8 @@ module Faker
|
|
64
55
|
end
|
65
56
|
|
66
57
|
def sentences(legacy_number = NOT_GIVEN, number: 3)
|
67
|
-
|
68
|
-
|
69
|
-
number = legacy_number
|
58
|
+
warn_for_deprecated_arguments do |keywords|
|
59
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
70
60
|
end
|
71
61
|
|
72
62
|
[].tap do |sentences|
|
@@ -77,22 +67,17 @@ module Faker
|
|
77
67
|
end
|
78
68
|
|
79
69
|
def paragraph(legacy_sentence_count = NOT_GIVEN, legacy_random_sentences_to_add = NOT_GIVEN, sentence_count: 3, random_sentences_to_add: 3)
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
end
|
84
|
-
if legacy_random_sentences_to_add != NOT_GIVEN
|
85
|
-
warn_with_uplevel 'Passing `random_sentences_to_add` with the 2nd argument of `Lovecraft.paragraph` is deprecated. Use keyword argument like `Lovecraft.paragraph(random_sentences_to_add: ...)` instead.', uplevel: 1
|
86
|
-
random_sentences_to_add = legacy_random_sentences_to_add
|
70
|
+
warn_for_deprecated_arguments do |keywords|
|
71
|
+
keywords << :sentence_count if legacy_sentence_count != NOT_GIVEN
|
72
|
+
keywords << :random_sentences_to_add if legacy_random_sentences_to_add != NOT_GIVEN
|
87
73
|
end
|
88
74
|
|
89
75
|
sentences(number: resolve(sentence_count) + rand(random_sentences_to_add.to_i).to_i).join(' ')
|
90
76
|
end
|
91
77
|
|
92
78
|
def paragraphs(legacy_number = NOT_GIVEN, number: 3)
|
93
|
-
|
94
|
-
|
95
|
-
number = legacy_number
|
79
|
+
warn_for_deprecated_arguments do |keywords|
|
80
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
96
81
|
end
|
97
82
|
|
98
83
|
[].tap do |paragraphs|
|
@@ -103,9 +88,8 @@ module Faker
|
|
103
88
|
end
|
104
89
|
|
105
90
|
def paragraph_by_chars(legacy_characters = NOT_GIVEN, characters: 256)
|
106
|
-
|
107
|
-
|
108
|
-
characters = legacy_characters
|
91
|
+
warn_for_deprecated_arguments do |keywords|
|
92
|
+
keywords << :characters if legacy_characters != NOT_GIVEN
|
109
93
|
end
|
110
94
|
|
111
95
|
paragraph = paragraph(sentence_count: 3)
|
@@ -6,9 +6,8 @@ module Faker
|
|
6
6
|
|
7
7
|
class << self
|
8
8
|
def city(legacy_options = NOT_GIVEN, options: {})
|
9
|
-
|
10
|
-
|
11
|
-
options = legacy_options
|
9
|
+
warn_for_deprecated_arguments do |keywords|
|
10
|
+
keywords << :options if legacy_options != NOT_GIVEN
|
12
11
|
end
|
13
12
|
|
14
13
|
parse(options[:with_state] ? 'address.city_with_state' : 'address.city')
|
@@ -19,9 +18,8 @@ module Faker
|
|
19
18
|
end
|
20
19
|
|
21
20
|
def street_address(legacy_include_secondary = NOT_GIVEN, include_secondary: false)
|
22
|
-
|
23
|
-
|
24
|
-
include_secondary = legacy_include_secondary
|
21
|
+
warn_for_deprecated_arguments do |keywords|
|
22
|
+
keywords << :include_secondary if legacy_include_secondary != NOT_GIVEN
|
25
23
|
end
|
26
24
|
|
27
25
|
numerify(parse('address.street_address') + (include_secondary ? ' ' + secondary_address : ''))
|
@@ -40,9 +38,8 @@ module Faker
|
|
40
38
|
end
|
41
39
|
|
42
40
|
def zip_code(legacy_state_abbreviation = NOT_GIVEN, state_abbreviation: '')
|
43
|
-
|
44
|
-
|
45
|
-
state_abbreviation = legacy_state_abbreviation
|
41
|
+
warn_for_deprecated_arguments do |keywords|
|
42
|
+
keywords << :state_abbreviation if legacy_state_abbreviation != NOT_GIVEN
|
46
43
|
end
|
47
44
|
|
48
45
|
if state_abbreviation.empty?
|
@@ -87,18 +84,16 @@ module Faker
|
|
87
84
|
end
|
88
85
|
|
89
86
|
def country_by_code(legacy_code = NOT_GIVEN, code: 'US')
|
90
|
-
|
91
|
-
|
92
|
-
code = legacy_code
|
87
|
+
warn_for_deprecated_arguments do |keywords|
|
88
|
+
keywords << :code if legacy_code != NOT_GIVEN
|
93
89
|
end
|
94
90
|
|
95
91
|
fetch('address.country_by_code.' + code)
|
96
92
|
end
|
97
93
|
|
98
94
|
def country_name_to_code(legacy_name = NOT_GIVEN, name: 'united_states')
|
99
|
-
|
100
|
-
|
101
|
-
name = legacy_name
|
95
|
+
warn_for_deprecated_arguments do |keywords|
|
96
|
+
keywords << :name if legacy_name != NOT_GIVEN
|
102
97
|
end
|
103
98
|
|
104
99
|
fetch('address.country_by_name.' + name)
|
@@ -6,9 +6,8 @@ module Faker
|
|
6
6
|
|
7
7
|
class << self
|
8
8
|
def alpha(legacy_number = NOT_GIVEN, number: 32)
|
9
|
-
|
10
|
-
|
11
|
-
number = legacy_number
|
9
|
+
warn_for_deprecated_arguments do |keywords|
|
10
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
12
11
|
end
|
13
12
|
char_count = resolve(number)
|
14
13
|
return '' if char_count.to_i < 1
|
@@ -31,22 +30,17 @@ module Faker
|
|
31
30
|
#
|
32
31
|
# @faker.version 2.1.3
|
33
32
|
def alphanumeric(legacy_number = NOT_GIVEN, number: 32, min_alpha: 0, min_numeric: 0)
|
34
|
-
|
35
|
-
|
36
|
-
number = legacy_number
|
33
|
+
warn_for_deprecated_arguments do |keywords|
|
34
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
37
35
|
end
|
38
36
|
char_count = resolve(number)
|
39
37
|
return '' if char_count.to_i < 1
|
40
38
|
raise ArgumentError, 'min_alpha must be greater than or equal to 0' if min_alpha&.negative?
|
41
39
|
raise ArgumentError, 'min_numeric must be greater than or equal to 0' if min_numeric&.negative?
|
42
40
|
|
43
|
-
if min_alpha.zero? && min_numeric.zero?
|
44
|
-
return Array.new(char_count) { sample(ALPHANUMS) }.join
|
45
|
-
end
|
41
|
+
return Array.new(char_count) { sample(ALPHANUMS) }.join if min_alpha.zero? && min_numeric.zero?
|
46
42
|
|
47
|
-
if min_alpha + min_numeric > char_count
|
48
|
-
raise ArgumentError, 'min_alpha + min_numeric must be <= number'
|
49
|
-
end
|
43
|
+
raise ArgumentError, 'min_alpha + min_numeric must be <= number' if min_alpha + min_numeric > char_count
|
50
44
|
|
51
45
|
random_count = char_count - min_alpha - min_numeric
|
52
46
|
|
data/lib/faker/default/app.rb
CHANGED
@@ -18,17 +18,10 @@ module Faker
|
|
18
18
|
# rubocop:disable Metrics/ParameterLists
|
19
19
|
def semantic_version(legacy_major = NOT_GIVEN, legacy_minor = NOT_GIVEN, legacy_patch = NOT_GIVEN, major: 0..9, minor: 0..9, patch: 1..9)
|
20
20
|
# rubocop:enable Metrics/ParameterLists
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
if legacy_minor != NOT_GIVEN
|
26
|
-
warn_with_uplevel 'Passing `minor` with the 2nd argument of `App.semantic_version` is deprecated. Use keyword argument like `App.semantic_version(minor: ...)` instead.', uplevel: 1
|
27
|
-
minor = legacy_minor
|
28
|
-
end
|
29
|
-
if legacy_patch != NOT_GIVEN
|
30
|
-
warn_with_uplevel 'Passing `patch` with the 3rd argument of `App.semantic_version` is deprecated. Use keyword argument like `App.semantic_version(patch: ...)` instead.', uplevel: 1
|
31
|
-
patch = legacy_patch
|
21
|
+
warn_for_deprecated_arguments do |keywords|
|
22
|
+
keywords << :major if legacy_major != NOT_GIVEN
|
23
|
+
keywords << :minor if legacy_minor != NOT_GIVEN
|
24
|
+
keywords << :patch if legacy_patch != NOT_GIVEN
|
32
25
|
end
|
33
26
|
|
34
27
|
[major, minor, patch].map { |chunk| sample(Array(chunk)) }.join('.')
|
data/lib/faker/default/avatar.rb
CHANGED
@@ -8,25 +8,12 @@ module Faker
|
|
8
8
|
# rubocop:disable Metrics/ParameterLists
|
9
9
|
def image(legacy_slug = NOT_GIVEN, legacy_size = NOT_GIVEN, legacy_format = NOT_GIVEN, legacy_set = NOT_GIVEN, legacy_bgset = NOT_GIVEN, slug: nil, size: '300x300', format: 'png', set: 'set1', bgset: nil)
|
10
10
|
# rubocop:enable Metrics/ParameterLists
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
size = legacy_size
|
18
|
-
end
|
19
|
-
if legacy_format != NOT_GIVEN
|
20
|
-
warn_with_uplevel 'Passing `format` with the 3rd argument of `Avatar.image` is deprecated. Use keyword argument like `Avatar.image(format: ...)` instead.', uplevel: 1
|
21
|
-
format = legacy_format
|
22
|
-
end
|
23
|
-
if legacy_set != NOT_GIVEN
|
24
|
-
warn_with_uplevel 'Passing `set` with the 4th argument of `Avatar.image` is deprecated. Use keyword argument like `Avatar.image(set: ...)` instead.', uplevel: 1
|
25
|
-
set = legacy_set
|
26
|
-
end
|
27
|
-
if legacy_bgset != NOT_GIVEN
|
28
|
-
warn_with_uplevel 'Passing `bgset` with the 5th argument of `Avatar.image` is deprecated. Use keyword argument like `Avatar.image(bgset: ...)` instead.', uplevel: 1
|
29
|
-
bgset = legacy_bgset
|
11
|
+
warn_for_deprecated_arguments do |keywords|
|
12
|
+
keywords << :slug if legacy_slug != NOT_GIVEN
|
13
|
+
keywords << :size if legacy_size != NOT_GIVEN
|
14
|
+
keywords << :format if legacy_format != NOT_GIVEN
|
15
|
+
keywords << :set if legacy_set != NOT_GIVEN
|
16
|
+
keywords << :bgset if legacy_bgset != NOT_GIVEN
|
30
17
|
end
|
31
18
|
|
32
19
|
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
|
data/lib/faker/default/bank.rb
CHANGED
@@ -6,9 +6,8 @@ module Faker
|
|
6
6
|
|
7
7
|
class << self
|
8
8
|
def account_number(legacy_digits = NOT_GIVEN, digits: 10)
|
9
|
-
|
10
|
-
|
11
|
-
digits = legacy_digits
|
9
|
+
warn_for_deprecated_arguments do |keywords|
|
10
|
+
keywords << :digits if legacy_digits != NOT_GIVEN
|
12
11
|
end
|
13
12
|
|
14
13
|
output = ''
|
@@ -22,9 +21,8 @@ module Faker
|
|
22
21
|
# Each country has it's own format for bank accounts
|
23
22
|
# Many of them use letters in certain parts of the account
|
24
23
|
# Using regex patterns we can create virtually any type of bank account
|
25
|
-
|
26
|
-
|
27
|
-
country_code = legacy_country_code
|
24
|
+
warn_for_deprecated_arguments do |keywords|
|
25
|
+
keywords << :country_code if legacy_country_code != NOT_GIVEN
|
28
26
|
end
|
29
27
|
|
30
28
|
begin
|
@@ -4,9 +4,8 @@ module Faker
|
|
4
4
|
class Boolean < Base
|
5
5
|
class << self
|
6
6
|
def boolean(legacy_true_ratio = NOT_GIVEN, true_ratio: 0.5)
|
7
|
-
|
8
|
-
|
9
|
-
true_ratio = legacy_true_ratio
|
7
|
+
warn_for_deprecated_arguments do |keywords|
|
8
|
+
keywords << :true_ratio if legacy_true_ratio != NOT_GIVEN
|
10
9
|
end
|
11
10
|
|
12
11
|
(rand < true_ratio)
|
@@ -7,13 +7,9 @@ module Faker
|
|
7
7
|
|
8
8
|
# Fixed param added for testing a specific RUT and check digit combination.
|
9
9
|
def rut(legacy_min_rut = NOT_GIVEN, legacy_fixed = NOT_GIVEN, min_rut: 1, fixed: false)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
14
|
-
if legacy_fixed != NOT_GIVEN
|
15
|
-
warn_with_uplevel 'Passing `fixed` with the 2nd argument of `ChileRut.rut` is deprecated. Use keyword argument like `ChileRut.rut(fixed: ...)` instead.', uplevel: 1
|
16
|
-
fixed = legacy_fixed
|
10
|
+
warn_for_deprecated_arguments do |keywords|
|
11
|
+
keywords << :min_rut if legacy_min_rut != NOT_GIVEN
|
12
|
+
keywords << :fixed if legacy_fixed != NOT_GIVEN
|
17
13
|
end
|
18
14
|
|
19
15
|
@last_rut = fixed ? min_rut : rand_in_range(min_rut, 99_999_999)
|
@@ -44,13 +40,9 @@ module Faker
|
|
44
40
|
end
|
45
41
|
|
46
42
|
def full_rut(legacy_min_rut = NOT_GIVEN, legacy_fixed = NOT_GIVEN, min_rut: 0, fixed: false)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
if legacy_fixed != NOT_GIVEN
|
52
|
-
warn_with_uplevel 'Passing `fixed` with the 2nd argument of `ChileRut.full_rut` is deprecated. Use keyword argument like `ChileRut.full_rut(fixed: ...)` instead.', uplevel: 1
|
53
|
-
fixed = legacy_fixed
|
43
|
+
warn_for_deprecated_arguments do |keywords|
|
44
|
+
keywords << :min_rut if legacy_min_rut != NOT_GIVEN
|
45
|
+
keywords << :fixed if legacy_fixed != NOT_GIVEN
|
54
46
|
end
|
55
47
|
|
56
48
|
"#{rut(min_rut: min_rut, fixed: fixed)}-#{dv}"
|