faker 2.2.1 → 2.2.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 +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
@@ -41,9 +41,8 @@ module Faker
|
|
41
41
|
# Can be used for both extensions and last four digits of phone number.
|
42
42
|
# Since extensions can be of variable length, this method taks a length parameter
|
43
43
|
def subscriber_number(legacy_length = NOT_GIVEN, length: 4)
|
44
|
-
|
45
|
-
|
46
|
-
length = legacy_length
|
44
|
+
warn_for_deprecated_arguments do |keywords|
|
45
|
+
keywords << :length if legacy_length != NOT_GIVEN
|
47
46
|
end
|
48
47
|
|
49
48
|
rand.to_s[2..(1 + length)]
|
@@ -8,25 +8,12 @@ module Faker
|
|
8
8
|
# rubocop:disable Metrics/ParameterLists
|
9
9
|
def image(legacy_size = NOT_GIVEN, legacy_format = NOT_GIVEN, legacy_background_color = NOT_GIVEN, legacy_text_color = NOT_GIVEN, legacy_text = NOT_GIVEN, size: '300x300', format: 'png', background_color: nil, text_color: nil, text: nil)
|
10
10
|
# rubocop:enable Metrics/ParameterLists
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
format = legacy_format
|
18
|
-
end
|
19
|
-
if legacy_background_color != NOT_GIVEN
|
20
|
-
warn_with_uplevel 'Passing `background_color` with the 3rd argument of `Placeholdit.image` is deprecated. Use keyword argument like `Placeholdit.image(background_color: ...)` instead.', uplevel: 1
|
21
|
-
background_color = legacy_background_color
|
22
|
-
end
|
23
|
-
if legacy_text_color != NOT_GIVEN
|
24
|
-
warn_with_uplevel 'Passing `text_color` with the 4th argument of `Placeholdit.image` is deprecated. Use keyword argument like `Placeholdit.image(text_color: ...)` instead.', uplevel: 1
|
25
|
-
text_color = legacy_text_color
|
26
|
-
end
|
27
|
-
if legacy_text != NOT_GIVEN
|
28
|
-
warn_with_uplevel 'Passing `text` with the 5th argument of `Placeholdit.image` is deprecated. Use keyword argument like `Placeholdit.image(text: ...)` instead.', uplevel: 1
|
29
|
-
text = legacy_text
|
11
|
+
warn_for_deprecated_arguments do |keywords|
|
12
|
+
keywords << :size if legacy_size != NOT_GIVEN
|
13
|
+
keywords << :format if legacy_format != NOT_GIVEN
|
14
|
+
keywords << :background_color if legacy_background_color != NOT_GIVEN
|
15
|
+
keywords << :text_color if legacy_text_color != NOT_GIVEN
|
16
|
+
keywords << :text if legacy_text != NOT_GIVEN
|
30
17
|
end
|
31
18
|
|
32
19
|
background_color = generate_color if background_color == :random
|
@@ -6,9 +6,8 @@ module Faker
|
|
6
6
|
|
7
7
|
class << self
|
8
8
|
def familial(legacy_connection = NOT_GIVEN, connection: nil)
|
9
|
-
|
10
|
-
|
11
|
-
connection = legacy_connection
|
9
|
+
warn_for_deprecated_arguments do |keywords|
|
10
|
+
keywords << :connection if legacy_connection != NOT_GIVEN
|
12
11
|
end
|
13
12
|
|
14
13
|
familial_connections = translate('faker.relationship.familial').keys
|
data/lib/faker/default/source.rb
CHANGED
@@ -4,22 +4,19 @@ module Faker
|
|
4
4
|
class Source < Base
|
5
5
|
class << self
|
6
6
|
def hello_world(legacy_lang = NOT_GIVEN, lang: :ruby)
|
7
|
-
|
8
|
-
|
9
|
-
lang = legacy_lang
|
7
|
+
warn_for_deprecated_arguments do |keywords|
|
8
|
+
keywords << :lang if legacy_lang != NOT_GIVEN
|
10
9
|
end
|
11
10
|
|
12
11
|
fetch("source.hello_world.#{lang}")
|
13
12
|
end
|
14
13
|
|
15
14
|
def print(legacy_str = NOT_GIVEN, legacy_lang = NOT_GIVEN, str: 'some string', lang: :ruby)
|
16
|
-
|
17
|
-
|
18
|
-
str = legacy_str
|
15
|
+
warn_for_deprecated_arguments do |keywords|
|
16
|
+
keywords << :str if legacy_str != NOT_GIVEN
|
19
17
|
end
|
20
|
-
|
21
|
-
|
22
|
-
lang = legacy_lang
|
18
|
+
warn_for_deprecated_arguments do |keywords|
|
19
|
+
keywords << :lang if legacy_lang != NOT_GIVEN
|
23
20
|
end
|
24
21
|
|
25
22
|
code = fetch("source.print.#{lang}")
|
@@ -27,9 +24,8 @@ module Faker
|
|
27
24
|
end
|
28
25
|
|
29
26
|
def print_1_to_10(legacy_lang = NOT_GIVEN, lang: :ruby)
|
30
|
-
|
31
|
-
|
32
|
-
lang = legacy_lang
|
27
|
+
warn_for_deprecated_arguments do |keywords|
|
28
|
+
keywords << :lang if legacy_lang != NOT_GIVEN
|
33
29
|
end
|
34
30
|
|
35
31
|
fetch("source.print_1_to_10.#{lang}")
|
data/lib/faker/default/string.rb
CHANGED
@@ -4,9 +4,8 @@ module Faker
|
|
4
4
|
class String < Base
|
5
5
|
class << self
|
6
6
|
def random(legacy_length = NOT_GIVEN, length: 32)
|
7
|
-
|
8
|
-
|
9
|
-
length = legacy_length
|
7
|
+
warn_for_deprecated_arguments do |keywords|
|
8
|
+
keywords << :length if legacy_length != NOT_GIVEN
|
10
9
|
end
|
11
10
|
|
12
11
|
utf8string select_a length
|
data/lib/faker/default/stripe.rb
CHANGED
@@ -4,9 +4,8 @@ module Faker
|
|
4
4
|
class Stripe < Base
|
5
5
|
class << self
|
6
6
|
def valid_card(legacy_card_type = NOT_GIVEN, card_type: nil)
|
7
|
-
|
8
|
-
|
9
|
-
card_type = legacy_card_type
|
7
|
+
warn_for_deprecated_arguments do |keywords|
|
8
|
+
keywords << :card_type if legacy_card_type != NOT_GIVEN
|
10
9
|
end
|
11
10
|
|
12
11
|
valid_cards = translate('faker.stripe.valid_cards').keys
|
@@ -24,9 +23,8 @@ module Faker
|
|
24
23
|
end
|
25
24
|
|
26
25
|
def valid_token(legacy_card_type = NOT_GIVEN, card_type: nil)
|
27
|
-
|
28
|
-
|
29
|
-
card_type = legacy_card_type
|
26
|
+
warn_for_deprecated_arguments do |keywords|
|
27
|
+
keywords << :card_type if legacy_card_type != NOT_GIVEN
|
30
28
|
end
|
31
29
|
|
32
30
|
valid_tokens = translate('faker.stripe.valid_tokens').keys
|
@@ -44,9 +42,8 @@ module Faker
|
|
44
42
|
end
|
45
43
|
|
46
44
|
def invalid_card(legacy_card_error = NOT_GIVEN, card_error: nil)
|
47
|
-
|
48
|
-
|
49
|
-
card_error = legacy_card_error
|
45
|
+
warn_for_deprecated_arguments do |keywords|
|
46
|
+
keywords << :card_error if legacy_card_error != NOT_GIVEN
|
50
47
|
end
|
51
48
|
|
52
49
|
invalid_cards = translate('faker.stripe.invalid_cards').keys
|
@@ -73,9 +70,8 @@ module Faker
|
|
73
70
|
end
|
74
71
|
|
75
72
|
def ccv(legacy_card_type = NOT_GIVEN, card_type: nil)
|
76
|
-
|
77
|
-
|
78
|
-
card_type = legacy_card_type
|
73
|
+
warn_for_deprecated_arguments do |keywords|
|
74
|
+
keywords << :card_type if legacy_card_type != NOT_GIVEN
|
79
75
|
end
|
80
76
|
|
81
77
|
(card_type.to_s == 'amex' ? rand_in_range(1000, 9999) : rand_in_range(100, 999)).to_s
|
data/lib/faker/default/time.rb
CHANGED
@@ -16,17 +16,10 @@ module Faker
|
|
16
16
|
# rubocop:disable Metrics/ParameterLists
|
17
17
|
def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, legacy_format = NOT_GIVEN, from:, to:, format: nil)
|
18
18
|
# rubocop:enable Metrics/ParameterLists
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
if legacy_to != NOT_GIVEN
|
24
|
-
warn_with_uplevel 'Passing `to` with the 2nd argument of `Time.between` is deprecated. Use keyword argument like `Time.between(to: ...)` instead.', uplevel: 1
|
25
|
-
to = legacy_to
|
26
|
-
end
|
27
|
-
if legacy_format != NOT_GIVEN
|
28
|
-
warn_with_uplevel 'Passing `format` with the 3rd argument of `Time.between` is deprecated. Use keyword argument like `Time.between(format: ...)` instead.', uplevel: 1
|
29
|
-
format = legacy_format
|
19
|
+
warn_for_deprecated_arguments do |keywords|
|
20
|
+
keywords << :from if legacy_from != NOT_GIVEN
|
21
|
+
keywords << :to if legacy_to != NOT_GIVEN
|
22
|
+
keywords << :format if legacy_format != NOT_GIVEN
|
30
23
|
end
|
31
24
|
|
32
25
|
from = get_time_object(from)
|
@@ -39,21 +32,11 @@ module Faker
|
|
39
32
|
# rubocop:disable Metrics/ParameterLists
|
40
33
|
def between_dates(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, legacy_period = NOT_GIVEN, legacy_format = NOT_GIVEN, from:, to:, period: :all, format: nil)
|
41
34
|
# rubocop:enable Metrics/ParameterLists
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
warn_with_uplevel 'Passing `to` with the 2nd argument of `Time.between_dates` is deprecated. Use keyword argument like `Time.between_dates(to: ...)` instead.', uplevel: 1
|
48
|
-
to = legacy_to
|
49
|
-
end
|
50
|
-
if legacy_period != NOT_GIVEN
|
51
|
-
warn_with_uplevel 'Passing `period` with the 3rd argument of `Time.between_dates` is deprecated. Use keyword argument like `Time.between_dates(period: ...)` instead.', uplevel: 1
|
52
|
-
period = legacy_period
|
53
|
-
end
|
54
|
-
if legacy_format != NOT_GIVEN
|
55
|
-
warn_with_uplevel 'Passing `format` with the 4th argument of `Time.between_dates` is deprecated. Use keyword argument like `Time.between_dates(format: ...)` instead.', uplevel: 1
|
56
|
-
format = legacy_format
|
35
|
+
warn_for_deprecated_arguments do |keywords|
|
36
|
+
keywords << :from if legacy_from != NOT_GIVEN
|
37
|
+
keywords << :to if legacy_to != NOT_GIVEN
|
38
|
+
keywords << :period if legacy_period != NOT_GIVEN
|
39
|
+
keywords << :format if legacy_format != NOT_GIVEN
|
57
40
|
end
|
58
41
|
|
59
42
|
date = Faker::Date.between(from: from, to: to)
|
@@ -64,17 +47,10 @@ module Faker
|
|
64
47
|
# rubocop:disable Metrics/ParameterLists
|
65
48
|
def forward(legacy_days = NOT_GIVEN, legacy_period = NOT_GIVEN, legacy_format = NOT_GIVEN, days: 365, period: :all, format: nil)
|
66
49
|
# rubocop:enable Metrics/ParameterLists
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
if legacy_period != NOT_GIVEN
|
72
|
-
warn_with_uplevel 'Passing `period` with the 2nd argument of `Time.forward` is deprecated. Use keyword argument like `Time.forward(period: ...)` instead.', uplevel: 1
|
73
|
-
period = legacy_period
|
74
|
-
end
|
75
|
-
if legacy_format != NOT_GIVEN
|
76
|
-
warn_with_uplevel 'Passing `format` with the 3rd argument of `Time.forward` is deprecated. Use keyword argument like `Time.forward(format: ...)` instead.', uplevel: 1
|
77
|
-
format = legacy_format
|
50
|
+
warn_for_deprecated_arguments do |keywords|
|
51
|
+
keywords << :days if legacy_days != NOT_GIVEN
|
52
|
+
keywords << :period if legacy_period != NOT_GIVEN
|
53
|
+
keywords << :format if legacy_format != NOT_GIVEN
|
78
54
|
end
|
79
55
|
|
80
56
|
time_with_format(date_with_random_time(Faker::Date.forward(days: days), period), format)
|
@@ -83,17 +59,10 @@ module Faker
|
|
83
59
|
# rubocop:disable Metrics/ParameterLists
|
84
60
|
def backward(legacy_days = NOT_GIVEN, legacy_period = NOT_GIVEN, legacy_format = NOT_GIVEN, days: 365, period: :all, format: nil)
|
85
61
|
# rubocop:enable Metrics/ParameterLists
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
if legacy_period != NOT_GIVEN
|
91
|
-
warn_with_uplevel 'Passing `period` with the 2nd argument of `Time.backward` is deprecated. Use keyword argument like `Time.backward(period: ...)` instead.', uplevel: 1
|
92
|
-
period = legacy_period
|
93
|
-
end
|
94
|
-
if legacy_format != NOT_GIVEN
|
95
|
-
warn_with_uplevel 'Passing `format` with the 3rd argument of `Time.backward` is deprecated. Use keyword argument like `Time.backward(format: ...)` instead.', uplevel: 1
|
96
|
-
format = legacy_format
|
62
|
+
warn_for_deprecated_arguments do |keywords|
|
63
|
+
keywords << :days if legacy_days != NOT_GIVEN
|
64
|
+
keywords << :period if legacy_period != NOT_GIVEN
|
65
|
+
keywords << :format if legacy_format != NOT_GIVEN
|
97
66
|
end
|
98
67
|
|
99
68
|
time_with_format(date_with_random_time(Faker::Date.backward(days: days), period), format)
|
@@ -4,13 +4,9 @@ module Faker
|
|
4
4
|
class Twitter < Base
|
5
5
|
class << self
|
6
6
|
def user(legacy_include_status = NOT_GIVEN, legacy_include_email = NOT_GIVEN, include_status: true, include_email: false)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
11
|
-
if legacy_include_email != NOT_GIVEN
|
12
|
-
warn_with_uplevel 'Passing `include_email` with the 2nd argument of `Twitter.user` is deprecated. Use keyword argument like `Twitter.user(include_email: ...)` instead.', uplevel: 1
|
13
|
-
include_email = legacy_include_email
|
7
|
+
warn_for_deprecated_arguments do |keywords|
|
8
|
+
keywords << :include_status if legacy_include_status != NOT_GIVEN
|
9
|
+
keywords << :include_email if legacy_include_email != NOT_GIVEN
|
14
10
|
end
|
15
11
|
|
16
12
|
user_id = id
|
@@ -24,7 +20,7 @@ module Faker
|
|
24
20
|
default_profile_image: Faker::Boolean.boolean(true_ratio: 0.1),
|
25
21
|
default_profile: Faker::Boolean.boolean(true_ratio: 0.1),
|
26
22
|
description: Faker::Lorem.sentence,
|
27
|
-
entities:
|
23
|
+
entities: user_entities,
|
28
24
|
favourites_count: Faker::Number.between(to: 1, from: 100_000),
|
29
25
|
follow_request_sent: false,
|
30
26
|
followers_count: Faker::Number.between(to: 1, from: 10_000_000),
|
@@ -64,13 +60,9 @@ module Faker
|
|
64
60
|
end
|
65
61
|
|
66
62
|
def status(legacy_include_user = NOT_GIVEN, legacy_include_photo = NOT_GIVEN, include_user: true, include_photo: false)
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
71
|
-
if legacy_include_photo != NOT_GIVEN
|
72
|
-
warn_with_uplevel 'Passing `include_photo` with the 2nd argument of `Twitter.status` is deprecated. Use keyword argument like `Twitter.status(include_photo: ...)` instead.', uplevel: 1
|
73
|
-
include_photo = legacy_include_photo
|
63
|
+
warn_for_deprecated_arguments do |keywords|
|
64
|
+
keywords << :include_user if legacy_include_user != NOT_GIVEN
|
65
|
+
keywords << :include_photo if legacy_include_photo != NOT_GIVEN
|
74
66
|
end
|
75
67
|
|
76
68
|
status_id = id
|
@@ -80,7 +72,7 @@ module Faker
|
|
80
72
|
contributors: nil,
|
81
73
|
coordinates: nil,
|
82
74
|
created_at: created_at,
|
83
|
-
entities:
|
75
|
+
entities: status_entities(include_photo: include_photo),
|
84
76
|
favorite_count: Faker::Number.between(to: 1, from: 10_000),
|
85
77
|
favorited: false,
|
86
78
|
geo: nil,
|
@@ -94,7 +86,7 @@ module Faker
|
|
94
86
|
place: nil,
|
95
87
|
possibly_sensitive: Faker::Boolean.boolean(true_ratio: 0.1),
|
96
88
|
retweet_count: Faker::Number.between(to: 1, from: 10_000),
|
97
|
-
retweeted_status:
|
89
|
+
retweeted_status: nil,
|
98
90
|
retweeted: false,
|
99
91
|
source: "<a href=\"#{Faker::Internet.url(host: 'example.com')}\" rel=\"nofollow\">#{Faker::Company.name}</a>",
|
100
92
|
text: Faker::Lorem.sentence,
|
@@ -125,26 +117,25 @@ module Faker
|
|
125
117
|
|
126
118
|
def user_entities
|
127
119
|
{
|
128
|
-
url:
|
120
|
+
url: {
|
129
121
|
urls: []
|
130
122
|
},
|
131
|
-
description:
|
123
|
+
description: {
|
132
124
|
urls: []
|
133
125
|
}
|
134
126
|
}
|
135
127
|
end
|
136
128
|
|
137
129
|
def status_entities(legacy_include_photo = NOT_GIVEN, include_photo: false)
|
138
|
-
|
139
|
-
|
140
|
-
include_photo = legacy_include_photo
|
130
|
+
warn_for_deprecated_arguments do |keywords|
|
131
|
+
keywords << :include_photo if legacy_include_photo != NOT_GIVEN
|
141
132
|
end
|
142
133
|
|
143
134
|
entities = {
|
144
|
-
hashtags:
|
145
|
-
symbols:
|
146
|
-
user_mentions:
|
147
|
-
urls:
|
135
|
+
hashtags: [],
|
136
|
+
symbols: [],
|
137
|
+
user_mentions: [],
|
138
|
+
urls: []
|
148
139
|
}
|
149
140
|
entities[:media] = [photo_entity] if include_photo
|
150
141
|
entities
|
@@ -158,7 +149,7 @@ module Faker
|
|
158
149
|
{
|
159
150
|
id: media_id,
|
160
151
|
id_str: media_id.to_s,
|
161
|
-
indices:
|
152
|
+
indices: [
|
162
153
|
103,
|
163
154
|
126
|
164
155
|
],
|
@@ -168,23 +159,23 @@ module Faker
|
|
168
159
|
display_url: 'example.com',
|
169
160
|
expanded_url: Faker::Internet.url(host: 'example.com'),
|
170
161
|
type: 'photo',
|
171
|
-
sizes:
|
172
|
-
medium:
|
162
|
+
sizes: {
|
163
|
+
medium: {
|
173
164
|
w: 1064,
|
174
165
|
h: 600,
|
175
166
|
resize: 'fit'
|
176
167
|
},
|
177
|
-
large:
|
168
|
+
large: {
|
178
169
|
w: 1064,
|
179
170
|
h: 600,
|
180
171
|
resize: 'fit'
|
181
172
|
},
|
182
|
-
small:
|
173
|
+
small: {
|
183
174
|
w: 680,
|
184
175
|
h: 383,
|
185
176
|
resize: 'fit'
|
186
177
|
},
|
187
|
-
thumb:
|
178
|
+
thumb: {
|
188
179
|
w: 150,
|
189
180
|
h: 150,
|
190
181
|
resize: 'crop'
|
data/lib/faker/default/types.rb
CHANGED
@@ -8,9 +8,8 @@ module Faker
|
|
8
8
|
|
9
9
|
class << self
|
10
10
|
def rb_string(legacy_words = NOT_GIVEN, words: 1)
|
11
|
-
|
12
|
-
|
13
|
-
words = legacy_words
|
11
|
+
warn_for_deprecated_arguments do |keywords|
|
12
|
+
keywords << :words if legacy_words != NOT_GIVEN
|
14
13
|
end
|
15
14
|
|
16
15
|
resolved_num = resolve(words)
|
@@ -26,26 +25,18 @@ module Faker
|
|
26
25
|
end
|
27
26
|
|
28
27
|
def rb_integer(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 0, to: 100)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
if legacy_to != NOT_GIVEN
|
34
|
-
warn_with_uplevel 'Passing `to` with the 2nd argument of `Types.rb_integer` is deprecated. Use keyword argument like `Types.rb_integer(to: ...)` instead.', uplevel: 1
|
35
|
-
to = legacy_to
|
28
|
+
warn_for_deprecated_arguments do |keywords|
|
29
|
+
keywords << :from if legacy_from != NOT_GIVEN
|
30
|
+
keywords << :to if legacy_to != NOT_GIVEN
|
36
31
|
end
|
37
32
|
|
38
33
|
rand(from..to).to_i
|
39
34
|
end
|
40
35
|
|
41
36
|
def rb_hash(legacy_number = NOT_GIVEN, legacy_type = NOT_GIVEN, number: 1, type: random_type)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
46
|
-
if legacy_type != NOT_GIVEN
|
47
|
-
warn_with_uplevel 'Passing `type` with the 2nd argument of `Types.rb_hash` is deprecated. Use keyword argument like `Types.rb_hash(type: ...)` instead.', uplevel: 1
|
48
|
-
type = legacy_type
|
37
|
+
warn_for_deprecated_arguments do |keywords|
|
38
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
39
|
+
keywords << :type if legacy_type != NOT_GIVEN
|
49
40
|
end
|
50
41
|
|
51
42
|
{}.tap do |hsh|
|
@@ -56,18 +47,16 @@ module Faker
|
|
56
47
|
end
|
57
48
|
|
58
49
|
def complex_rb_hash(legacy_number = NOT_GIVEN, number: 1)
|
59
|
-
|
60
|
-
|
61
|
-
number = legacy_number
|
50
|
+
warn_for_deprecated_arguments do |keywords|
|
51
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
62
52
|
end
|
63
53
|
|
64
54
|
rb_hash(number: number, type: random_complex_type)
|
65
55
|
end
|
66
56
|
|
67
57
|
def rb_array(legacy_len = NOT_GIVEN, len: 1)
|
68
|
-
|
69
|
-
|
70
|
-
len = legacy_len
|
58
|
+
warn_for_deprecated_arguments do |keywords|
|
59
|
+
keywords << :len if legacy_len != NOT_GIVEN
|
71
60
|
end
|
72
61
|
|
73
62
|
[].tap do |ar|
|