faker 2.2.1 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +130 -0
- data/README.md +2 -2
- data/lib/faker.rb +34 -0
- data/lib/faker/blockchain/aeternity.rb +70 -0
- data/lib/faker/blockchain/bitcoin.rb +26 -0
- data/lib/faker/blockchain/ethereum.rb +10 -0
- data/lib/faker/blockchain/tezos.rb +62 -6
- data/lib/faker/books/book.rb +36 -0
- data/lib/faker/books/culture_series.rb +49 -0
- data/lib/faker/books/dune.rb +60 -9
- data/lib/faker/books/lovecraft.rb +189 -33
- data/lib/faker/creature/animal.rb +9 -0
- data/lib/faker/creature/cat.rb +27 -0
- data/lib/faker/creature/dog.rb +72 -0
- data/lib/faker/creature/horse.rb +18 -0
- data/lib/faker/default/address.rb +10 -15
- data/lib/faker/default/alphanumeric.rb +29 -18
- data/lib/faker/default/app.rb +50 -11
- data/lib/faker/default/appliance.rb +18 -0
- data/lib/faker/default/artist.rb +9 -0
- data/lib/faker/default/avatar.rb +38 -19
- data/lib/faker/default/bank.rb +4 -6
- data/lib/faker/default/boolean.rb +14 -4
- data/lib/faker/default/chile_rut.rb +6 -14
- data/lib/faker/default/chuck_norris.rb +1 -1
- 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 +100 -30
- data/lib/faker/default/demographic.rb +2 -3
- data/lib/faker/default/dessert.rb +27 -0
- data/lib/faker/default/device.rb +54 -0
- data/lib/faker/default/driving_licence.rb +7 -17
- data/lib/faker/default/electrical_components.rb +27 -0
- 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/gender.rb +18 -0
- data/lib/faker/default/greek_philosophers.rb +18 -0
- data/lib/faker/default/hacker.rb +59 -1
- data/lib/faker/default/hipster.rb +21 -54
- data/lib/faker/default/house.rb +18 -0
- data/lib/faker/default/id_number.rb +5 -7
- data/lib/faker/default/industry_segments.rb +36 -0
- data/lib/faker/default/internet.rb +49 -76
- data/lib/faker/default/invoice.rb +7 -13
- data/lib/faker/default/json.rb +9 -16
- data/lib/faker/default/lorem.rb +38 -77
- 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/marketing.rb +9 -0
- data/lib/faker/default/measurement.rb +16 -24
- data/lib/faker/default/military.rb +45 -0
- data/lib/faker/default/name.rb +2 -3
- data/lib/faker/default/nation.rb +48 -5
- data/lib/faker/default/nato_phonetic_alphabet.rb +9 -0
- data/lib/faker/default/nhs.rb +2 -3
- data/lib/faker/default/number.rb +149 -50
- data/lib/faker/default/omniauth.rb +67 -63
- data/lib/faker/default/phone_number.rb +2 -3
- data/lib/faker/default/placeholdit.rb +6 -19
- data/lib/faker/default/programming_language.rb +18 -0
- data/lib/faker/default/relationship.rb +2 -3
- data/lib/faker/default/restaurant.rb +54 -2
- data/lib/faker/default/science.rb +27 -0
- data/lib/faker/default/source.rb +51 -14
- data/lib/faker/default/string.rb +2 -3
- data/lib/faker/default/stripe.rb +8 -12
- data/lib/faker/default/subscription.rb +45 -0
- data/lib/faker/default/superhero.rb +45 -0
- data/lib/faker/default/time.rb +102 -56
- 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 +55 -10
- data/lib/faker/games/dota.rb +49 -3
- data/lib/faker/games/elder_scrolls.rb +72 -0
- data/lib/faker/games/fallout.rb +37 -0
- data/lib/faker/games/game.rb +27 -0
- data/lib/faker/games/half_life.rb +27 -0
- data/lib/faker/games/heroes.rb +27 -0
- data/lib/faker/games/heroes_of_the_storm.rb +36 -0
- data/lib/faker/games/league_of_legends.rb +54 -0
- data/lib/faker/games/myst.rb +45 -0
- data/lib/faker/games/overwatch.rb +27 -0
- data/lib/faker/games/pokemon.rb +27 -0
- data/lib/faker/games/sonic_the_hedgehog.rb +27 -0
- data/lib/faker/games/super_smash_bros.rb +18 -0
- data/lib/faker/games/witcher.rb +54 -0
- data/lib/faker/games/world_of_warcraft.rb +18 -0
- data/lib/faker/games/zelda.rb +37 -1
- data/lib/faker/japanese_media/dragon_ball.rb +9 -0
- data/lib/faker/japanese_media/one_piece.rb +54 -0
- data/lib/faker/japanese_media/sword_art_online.rb +36 -0
- data/lib/faker/movies/back_to_the_future.rb +28 -0
- data/lib/faker/movies/ghostbusters.rb +28 -0
- data/lib/faker/movies/harry_potter.rb +54 -0
- data/lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb +69 -0
- data/lib/faker/movies/hobbit.rb +37 -0
- data/lib/faker/movies/lebowski.rb +27 -0
- data/lib/faker/movies/lord_of_the_rings.rb +28 -0
- data/lib/faker/movies/movie.rb +9 -0
- data/lib/faker/movies/princess_bride.rb +19 -0
- data/lib/faker/movies/star_wars.rb +97 -6
- data/lib/faker/movies/v_for_vendetta.rb +29 -0
- data/lib/faker/music/grateful_dead.rb +18 -0
- data/lib/faker/music/phish.rb +9 -0
- data/lib/faker/music/rock_band.rb +9 -0
- data/lib/faker/music/umphreys_mcgee.rb +9 -0
- data/lib/faker/sports/basketball.rb +36 -0
- data/lib/faker/sports/football.rb +45 -0
- data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +9 -0
- data/lib/faker/tv_shows/bojack_horseman.rb +28 -0
- data/lib/faker/tv_shows/breaking_bad.rb +18 -0
- data/lib/faker/tv_shows/buffy.rb +45 -0
- data/lib/faker/tv_shows/community.rb +19 -0
- data/lib/faker/tv_shows/dr_who.rb +78 -2
- data/lib/faker/tv_shows/dumb_and_dumber.rb +28 -0
- data/lib/faker/tv_shows/family_guy.rb +28 -0
- data/lib/faker/tv_shows/friends.rb +27 -0
- data/lib/faker/tv_shows/game_of_thrones.rb +46 -0
- data/lib/faker/tv_shows/hey_arnold.rb +27 -0
- data/lib/faker/tv_shows/how_i_met_your_mother.rb +37 -0
- data/lib/faker/tv_shows/michael_scott.rb +13 -0
- data/lib/faker/tv_shows/new_girl.rb +19 -0
- data/lib/faker/tv_shows/parks_and_rec.rb +18 -0
- data/lib/faker/tv_shows/rick_and_morty.rb +28 -0
- data/lib/faker/tv_shows/ru_paul.rb +18 -0
- data/lib/faker/tv_shows/seinfeld.rb +28 -0
- data/lib/faker/tv_shows/silicon_valley.rb +75 -0
- data/lib/faker/tv_shows/simpsons.rb +28 -0
- data/lib/faker/tv_shows/south_park.rb +19 -0
- data/lib/faker/tv_shows/star_trek.rb +36 -0
- data/lib/faker/tv_shows/stargate.rb +28 -0
- data/lib/faker/tv_shows/stranger_things.rb +19 -0
- data/lib/faker/tv_shows/the_expanse.rb +36 -0
- data/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb +28 -0
- data/lib/faker/tv_shows/the_it_crowd.rb +37 -0
- data/lib/faker/tv_shows/the_thick_of_it.rb +28 -0
- data/lib/faker/tv_shows/twin_peaks.rb +28 -0
- data/lib/faker/tv_shows/venture_bros.rb +38 -0
- data/lib/faker/version.rb +1 -1
- data/lib/locales/en-CA.yml +1 -1
- data/lib/locales/en-TH.yml +360 -0
- data/lib/locales/en/color.yml +1 -1
- data/lib/locales/en/dr_who.yml +1 -1
- data/lib/locales/en/science.yml +1 -1
- data/lib/locales/ja.yml +8 -9
- data/lib/locales/th.yml +380 -0
- metadata +40 -15
data/lib/faker/default/json.rb
CHANGED
@@ -4,13 +4,9 @@ module Faker
|
|
4
4
|
|
5
5
|
class << self
|
6
6
|
def shallow_json(legacy_width = NOT_GIVEN, legacy_options = NOT_GIVEN, width: 3, options: { key: 'Name.first_name', value: 'Name.first_name' })
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
11
|
-
if legacy_options != NOT_GIVEN
|
12
|
-
warn_with_uplevel 'Passing `options` with the 2nd argument of `Json.shallow_json` is deprecated. Use keyword argument like `Json.shallow_json(options: ...)` instead.', uplevel: 1
|
13
|
-
options = legacy_options
|
7
|
+
warn_for_deprecated_arguments do |keywords|
|
8
|
+
keywords << :width if legacy_width != NOT_GIVEN
|
9
|
+
keywords << :options if legacy_options != NOT_GIVEN
|
14
10
|
end
|
15
11
|
|
16
12
|
options[:key] = 'Faker::' + options[:key]
|
@@ -23,17 +19,14 @@ module Faker
|
|
23
19
|
# rubocop:disable Metrics/ParameterLists
|
24
20
|
def add_depth_to_json(legacy_json = NOT_GIVEN, legacy_width = NOT_GIVEN, legacy_options = NOT_GIVEN, json: shallow_json, width: 3, options: { key: 'Name.first_name', value: 'Name.first_name' })
|
25
21
|
# rubocop:enable Metrics/ParameterLists
|
26
|
-
|
27
|
-
|
28
|
-
json = legacy_json
|
22
|
+
warn_for_deprecated_arguments do |keywords|
|
23
|
+
keywords << :json if legacy_json != NOT_GIVEN
|
29
24
|
end
|
30
|
-
|
31
|
-
|
32
|
-
width = legacy_width
|
25
|
+
warn_for_deprecated_arguments do |keywords|
|
26
|
+
keywords << :width if legacy_width != NOT_GIVEN
|
33
27
|
end
|
34
|
-
|
35
|
-
|
36
|
-
options = legacy_options
|
28
|
+
warn_for_deprecated_arguments do |keywords|
|
29
|
+
keywords << :options if legacy_options != NOT_GIVEN
|
37
30
|
end
|
38
31
|
|
39
32
|
options[:key] = 'Faker::' + options[:key]
|
data/lib/faker/default/lorem.rb
CHANGED
@@ -9,13 +9,9 @@ module Faker
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def words(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
16
|
-
if legacy_supplemental != NOT_GIVEN
|
17
|
-
warn_with_uplevel 'Passing `supplemental` with the 2nd argument of `Lorem.words` is deprecated. Use keyword argument like `Lorem.words(supplemental: ...)` instead.', uplevel: 1
|
18
|
-
supplemental = legacy_supplemental
|
12
|
+
warn_for_deprecated_arguments do |keywords|
|
13
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
14
|
+
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
19
15
|
end
|
20
16
|
|
21
17
|
resolved_num = resolve(number)
|
@@ -34,22 +30,22 @@ module Faker
|
|
34
30
|
##
|
35
31
|
# Produces a random string of alphanumeric characters
|
36
32
|
#
|
37
|
-
# @param [Integer] number
|
38
|
-
# @param [Integer]
|
39
|
-
# @param [Integer]
|
33
|
+
# @param number [Integer] The number of characters to generate
|
34
|
+
# @param min_alpha [Integer] The minimum number of alphabetic to add to the string
|
35
|
+
# @param min_numeric [Integer] The minimum number of numbers to add to the string
|
40
36
|
#
|
41
37
|
# @return [String]
|
42
38
|
#
|
43
|
-
# @example
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
39
|
+
# @example
|
40
|
+
# Faker::Lorem.characters #=> "uw1ep04lhs0c4d931n1jmrspprf5w..."
|
41
|
+
# Faker::Lorem.characters(number: 10) #=> "ang9cbhoa8"
|
42
|
+
# Faker::Lorem.characters(number: 10, min_alpha: 4) #=> "ang9cbhoa8"
|
43
|
+
# Faker::Lorem.characters(number: 10, min_alpha: 4, min_numeric: 1) #=> "ang9cbhoa8"
|
47
44
|
#
|
48
45
|
# @faker.version 2.1.3
|
49
46
|
def characters(legacy_number = NOT_GIVEN, number: 255, min_alpha: 0, min_numeric: 0)
|
50
|
-
|
51
|
-
|
52
|
-
number = legacy_number
|
47
|
+
warn_for_deprecated_arguments do |keywords|
|
48
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
53
49
|
end
|
54
50
|
|
55
51
|
Alphanumeric.alphanumeric(number: number, min_alpha: min_alpha, min_numeric: min_numeric)
|
@@ -62,30 +58,19 @@ module Faker
|
|
62
58
|
# rubocop:disable Metrics/ParameterLists
|
63
59
|
def sentence(legacy_word_count = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, legacy_random_words_to_add = NOT_GIVEN, word_count: 4, supplemental: false, random_words_to_add: 0)
|
64
60
|
# rubocop:enable Metrics/ParameterLists
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
if legacy_supplemental != NOT_GIVEN
|
70
|
-
warn_with_uplevel 'Passing `supplemental` with the 2nd argument of `Lorem.sentence` is deprecated. Use keyword argument like `Lorem.sentence(supplemental: ...)` instead.', uplevel: 1
|
71
|
-
supplemental = legacy_supplemental
|
72
|
-
end
|
73
|
-
if legacy_random_words_to_add != NOT_GIVEN
|
74
|
-
warn_with_uplevel 'Passing `random_words_to_add` with the 3rd argument of `Lorem.sentence` is deprecated. Use keyword argument like `Lorem.sentence(random_words_to_add: ...)` instead.', uplevel: 1
|
75
|
-
random_words_to_add = legacy_random_words_to_add
|
61
|
+
warn_for_deprecated_arguments do |keywords|
|
62
|
+
keywords << :word_count if legacy_word_count != NOT_GIVEN
|
63
|
+
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
64
|
+
keywords << :random_words_to_add if legacy_random_words_to_add != NOT_GIVEN
|
76
65
|
end
|
77
66
|
|
78
67
|
words(number: word_count + rand(random_words_to_add.to_i), supplemental: supplemental).join(' ').capitalize + locale_period
|
79
68
|
end
|
80
69
|
|
81
70
|
def sentences(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
end
|
86
|
-
if legacy_supplemental != NOT_GIVEN
|
87
|
-
warn_with_uplevel 'Passing `supplemental` with the 2nd argument of `Lorem.sentences` is deprecated. Use keyword argument like `Lorem.sentences(supplemental: ...)` instead.', uplevel: 1
|
88
|
-
supplemental = legacy_supplemental
|
71
|
+
warn_for_deprecated_arguments do |keywords|
|
72
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
73
|
+
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
89
74
|
end
|
90
75
|
|
91
76
|
1.upto(resolve(number)).collect { sentence(word_count: 3, supplemental: supplemental) }
|
@@ -94,43 +79,30 @@ module Faker
|
|
94
79
|
# rubocop:disable Metrics/ParameterLists
|
95
80
|
def paragraph(legacy_sentence_count = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, legacy_random_sentences_to_add = NOT_GIVEN, sentence_count: 3, supplemental: false, random_sentences_to_add: 0)
|
96
81
|
# rubocop:enable Metrics/ParameterLists
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
if legacy_supplemental != NOT_GIVEN
|
102
|
-
warn_with_uplevel 'Passing `supplemental` with the 2nd argument of `Lorem.paragraph` is deprecated. Use keyword argument like `Lorem.paragraph(supplemental: ...)` instead.', uplevel: 1
|
103
|
-
supplemental = legacy_supplemental
|
104
|
-
end
|
105
|
-
if legacy_random_sentences_to_add != NOT_GIVEN
|
106
|
-
warn_with_uplevel 'Passing `random_sentences_to_add` with the 3rd argument of `Lorem.paragraph` is deprecated. Use keyword argument like `Lorem.paragraph(random_sentences_to_add: ...)` instead.', uplevel: 1
|
107
|
-
random_sentences_to_add = legacy_random_sentences_to_add
|
82
|
+
warn_for_deprecated_arguments do |keywords|
|
83
|
+
keywords << :sentence_count if legacy_sentence_count != NOT_GIVEN
|
84
|
+
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
85
|
+
keywords << :random_sentences_to_add if legacy_random_sentences_to_add != NOT_GIVEN
|
108
86
|
end
|
109
87
|
|
110
88
|
sentences(number: resolve(sentence_count) + rand(random_sentences_to_add.to_i), supplemental: supplemental).join(locale_space)
|
111
89
|
end
|
112
90
|
|
113
91
|
def paragraphs(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
|
114
|
-
|
115
|
-
|
116
|
-
number = legacy_number
|
92
|
+
warn_for_deprecated_arguments do |keywords|
|
93
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
117
94
|
end
|
118
|
-
|
119
|
-
|
120
|
-
supplemental = legacy_supplemental
|
95
|
+
warn_for_deprecated_arguments do |keywords|
|
96
|
+
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
121
97
|
end
|
122
98
|
|
123
99
|
1.upto(resolve(number)).collect { paragraph(sentence_count: 3, supplemental: supplemental) }
|
124
100
|
end
|
125
101
|
|
126
102
|
def paragraph_by_chars(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 256, supplemental: false)
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
end
|
131
|
-
if legacy_supplemental != NOT_GIVEN
|
132
|
-
warn_with_uplevel 'Passing `supplemental` with the 2nd argument of `Lorem.paragraph_by_chars` is deprecated. Use keyword argument like `Lorem.paragraph_by_chars(supplemental: ...)` instead.', uplevel: 1
|
133
|
-
supplemental = legacy_supplemental
|
103
|
+
warn_for_deprecated_arguments do |keywords|
|
104
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
105
|
+
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
134
106
|
end
|
135
107
|
|
136
108
|
paragraph = paragraph(sentence_count: 3, supplemental: supplemental)
|
@@ -143,30 +115,19 @@ module Faker
|
|
143
115
|
# rubocop:disable Metrics/ParameterLists
|
144
116
|
def question(legacy_word_count = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, legacy_random_words_to_add = NOT_GIVEN, word_count: 4, supplemental: false, random_words_to_add: 0)
|
145
117
|
# rubocop:enable Metrics/ParameterLists
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
if legacy_supplemental != NOT_GIVEN
|
151
|
-
warn_with_uplevel 'Passing `supplemental` with the 2nd argument of `Lorem.question` is deprecated. Use keyword argument like `Lorem.question(supplemental: ...)` instead.', uplevel: 1
|
152
|
-
supplemental = legacy_supplemental
|
153
|
-
end
|
154
|
-
if legacy_random_words_to_add != NOT_GIVEN
|
155
|
-
warn_with_uplevel 'Passing `random_words_to_add` with the 3rd argument of `Lorem.question` is deprecated. Use keyword argument like `Lorem.question(random_words_to_add: ...)` instead.', uplevel: 1
|
156
|
-
random_words_to_add = legacy_random_words_to_add
|
118
|
+
warn_for_deprecated_arguments do |keywords|
|
119
|
+
keywords << :word_count if legacy_word_count != NOT_GIVEN
|
120
|
+
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
121
|
+
keywords << :random_words_to_add if legacy_random_words_to_add != NOT_GIVEN
|
157
122
|
end
|
158
123
|
|
159
124
|
words(number: word_count + rand(random_words_to_add), supplemental: supplemental).join(' ').capitalize + locale_question_mark
|
160
125
|
end
|
161
126
|
|
162
127
|
def questions(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
end
|
167
|
-
if legacy_supplemental != NOT_GIVEN
|
168
|
-
warn_with_uplevel 'Passing `supplemental` with the 2nd argument of `Lorem.questions` is deprecated. Use keyword argument like `Lorem.questions(supplemental: ...)` instead.', uplevel: 1
|
169
|
-
supplemental = legacy_supplemental
|
128
|
+
warn_for_deprecated_arguments do |keywords|
|
129
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
130
|
+
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
170
131
|
end
|
171
132
|
|
172
133
|
1.upto(resolve(number)).collect { question(word_count: 3, supplemental: supplemental) }
|
@@ -8,17 +8,10 @@ module Faker
|
|
8
8
|
# rubocop:disable Metrics/ParameterLists
|
9
9
|
def image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: [], match_all: false)
|
10
10
|
# rubocop:enable Metrics/ParameterLists
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
if legacy_search_terms != NOT_GIVEN
|
16
|
-
warn_with_uplevel 'Passing `search_terms` with the 2nd argument of `LoremFlickr.image` is deprecated. Use keyword argument like `LoremFlickr.image(search_terms: ...)` instead.', uplevel: 1
|
17
|
-
search_terms = legacy_search_terms
|
18
|
-
end
|
19
|
-
if legacy_match_all != NOT_GIVEN
|
20
|
-
warn_with_uplevel 'Passing `match_all` with the 3rd argument of `LoremFlickr.image` is deprecated. Use keyword argument like `LoremFlickr.image(match_all: ...)` instead.', uplevel: 1
|
21
|
-
match_all = legacy_match_all
|
11
|
+
warn_for_deprecated_arguments do |keywords|
|
12
|
+
keywords << :size if legacy_size != NOT_GIVEN
|
13
|
+
keywords << :search_terms if legacy_search_terms != NOT_GIVEN
|
14
|
+
keywords << :match_all if legacy_match_all != NOT_GIVEN
|
22
15
|
end
|
23
16
|
|
24
17
|
build_url(size, nil, search_terms, match_all)
|
@@ -27,17 +20,10 @@ module Faker
|
|
27
20
|
# rubocop:disable Metrics/ParameterLists
|
28
21
|
def grayscale_image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: ['all'], match_all: false)
|
29
22
|
# rubocop:enable Metrics/ParameterLists
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
if legacy_search_terms != NOT_GIVEN
|
35
|
-
warn_with_uplevel 'Passing `search_terms` with the 2nd argument of `LoremFlickr.grayscale_image` is deprecated. Use keyword argument like `LoremFlickr.grayscale_image(search_terms: ...)` instead.', uplevel: 1
|
36
|
-
search_terms = legacy_search_terms
|
37
|
-
end
|
38
|
-
if legacy_match_all != NOT_GIVEN
|
39
|
-
warn_with_uplevel 'Passing `match_all` with the 3rd argument of `LoremFlickr.grayscale_image` is deprecated. Use keyword argument like `LoremFlickr.grayscale_image(match_all: ...)` instead.', uplevel: 1
|
40
|
-
match_all = legacy_match_all
|
23
|
+
warn_for_deprecated_arguments do |keywords|
|
24
|
+
keywords << :size if legacy_size != NOT_GIVEN
|
25
|
+
keywords << :search_terms if legacy_search_terms != NOT_GIVEN
|
26
|
+
keywords << :match_all if legacy_match_all != NOT_GIVEN
|
41
27
|
end
|
42
28
|
|
43
29
|
raise ArgumentError, 'Search terms must be specified for grayscale images' unless search_terms.any?
|
@@ -48,17 +34,10 @@ module Faker
|
|
48
34
|
# rubocop:disable Metrics/ParameterLists
|
49
35
|
def pixelated_image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: ['all'], match_all: false)
|
50
36
|
# rubocop:enable Metrics/ParameterLists
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
if legacy_search_terms != NOT_GIVEN
|
56
|
-
warn_with_uplevel 'Passing `search_terms` with the 2nd argument of `LoremFlickr.pixelated_image` is deprecated. Use keyword argument like `LoremFlickr.pixelated_image(search_terms: ...)` instead.', uplevel: 1
|
57
|
-
search_terms = legacy_search_terms
|
58
|
-
end
|
59
|
-
if legacy_match_all != NOT_GIVEN
|
60
|
-
warn_with_uplevel 'Passing `match_all` with the 3rd argument of `LoremFlickr.pixelated_image` is deprecated. Use keyword argument like `LoremFlickr.pixelated_image(match_all: ...)` instead.', uplevel: 1
|
61
|
-
match_all = legacy_match_all
|
37
|
+
warn_for_deprecated_arguments do |keywords|
|
38
|
+
keywords << :size if legacy_size != NOT_GIVEN
|
39
|
+
keywords << :search_terms if legacy_search_terms != NOT_GIVEN
|
40
|
+
keywords << :match_all if legacy_match_all != NOT_GIVEN
|
62
41
|
end
|
63
42
|
|
64
43
|
raise ArgumentError, 'Search terms must be specified for pixelated images' unless search_terms.any?
|
@@ -69,21 +48,11 @@ module Faker
|
|
69
48
|
# rubocop:disable Metrics/ParameterLists
|
70
49
|
def colorized_image(legacy_size = NOT_GIVEN, legacy_color = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', color: 'red', search_terms: ['all'], match_all: false)
|
71
50
|
# rubocop:enable Metrics/ParameterLists
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
warn_with_uplevel 'Passing `color` with the 2nd argument of `LoremFlickr.colorized_image` is deprecated. Use keyword argument like `LoremFlickr.colorized_image(color: ...)` instead.', uplevel: 1
|
78
|
-
color = legacy_color
|
79
|
-
end
|
80
|
-
if legacy_search_terms != NOT_GIVEN
|
81
|
-
warn_with_uplevel 'Passing `search_terms` with the 3rd argument of `LoremFlickr.colorized_image` is deprecated. Use keyword argument like `LoremFlickr.colorized_image(search_terms: ...)` instead.', uplevel: 1
|
82
|
-
search_terms = legacy_search_terms
|
83
|
-
end
|
84
|
-
if legacy_match_all != NOT_GIVEN
|
85
|
-
warn_with_uplevel 'Passing `match_all` with the 4th argument of `LoremFlickr.colorized_image` is deprecated. Use keyword argument like `LoremFlickr.colorized_image(match_all: ...)` instead.', uplevel: 1
|
86
|
-
match_all = legacy_match_all
|
51
|
+
warn_for_deprecated_arguments do |keywords|
|
52
|
+
keywords << :size if legacy_size != NOT_GIVEN
|
53
|
+
keywords << :color if legacy_color != NOT_GIVEN
|
54
|
+
keywords << :search_terms if legacy_search_terms != NOT_GIVEN
|
55
|
+
keywords << :match_all if legacy_match_all != NOT_GIVEN
|
87
56
|
end
|
88
57
|
|
89
58
|
raise ArgumentError, 'Search terms must be specified for colorized images' unless search_terms.any?
|
@@ -19,29 +19,13 @@ module Faker
|
|
19
19
|
|
20
20
|
# rubocop:disable Metrics/ParameterLists
|
21
21
|
def image(legacy_size = NOT_GIVEN, legacy_is_gray = NOT_GIVEN, legacy_category = NOT_GIVEN, legacy_number = NOT_GIVEN, legacy_text = NOT_GIVEN, legacy_secure = NOT_GIVEN, size: '300x300', is_gray: false, category: nil, number: nil, text: nil, secure: true)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
if legacy_category != NOT_GIVEN
|
31
|
-
warn_with_uplevel 'Passing `category` with the 3rd argument of `LoremPixel.image` is deprecated. Use keyword argument like `LoremPixel.image(category: ...)` instead.', uplevel: 1
|
32
|
-
category = legacy_category
|
33
|
-
end
|
34
|
-
if legacy_number != NOT_GIVEN
|
35
|
-
warn_with_uplevel 'Passing `number` with the 4th argument of `LoremPixel.image` is deprecated. Use keyword argument like `LoremPixel.image(number: ...)` instead.', uplevel: 1
|
36
|
-
number = legacy_number
|
37
|
-
end
|
38
|
-
if legacy_text != NOT_GIVEN
|
39
|
-
warn_with_uplevel 'Passing `text` with the 5th argument of `LoremPixel.image` is deprecated. Use keyword argument like `LoremPixel.image(text: ...)` instead.', uplevel: 1
|
40
|
-
text = legacy_text
|
41
|
-
end
|
42
|
-
if legacy_secure != NOT_GIVEN
|
43
|
-
warn_with_uplevel 'Passing `secure` with the 6th argument of `LoremPixel.image` is deprecated. Use keyword argument like `LoremPixel.image(secure: ...)` instead.', uplevel: 1
|
44
|
-
secure = legacy_secure
|
22
|
+
warn_for_deprecated_arguments do |keywords|
|
23
|
+
keywords << :size if legacy_size != NOT_GIVEN
|
24
|
+
keywords << :is_gray if legacy_is_gray != NOT_GIVEN
|
25
|
+
keywords << :category if legacy_category != NOT_GIVEN
|
26
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
27
|
+
keywords << :text if legacy_text != NOT_GIVEN
|
28
|
+
keywords << :secure if legacy_secure != NOT_GIVEN
|
45
29
|
end
|
46
30
|
|
47
31
|
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
|
@@ -60,13 +60,9 @@ module Faker
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def sandwich(legacy_sentences = NOT_GIVEN, legacy_repeat = NOT_GIVEN, sentences: 3, repeat: 1)
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
end
|
67
|
-
if legacy_repeat != NOT_GIVEN
|
68
|
-
warn_with_uplevel 'Passing `repeat` with the 2nd argument of `Markdown.sandwich` is deprecated. Use keyword argument like `Markdown.sandwich(repeat: ...)` instead.', uplevel: 1
|
69
|
-
repeat = legacy_repeat
|
63
|
+
warn_for_deprecated_arguments do |keywords|
|
64
|
+
keywords << :sentences if legacy_sentences != NOT_GIVEN
|
65
|
+
keywords << :repeat if legacy_repeat != NOT_GIVEN
|
70
66
|
end
|
71
67
|
|
72
68
|
text_block = []
|
@@ -5,6 +5,15 @@ module Faker
|
|
5
5
|
flexible :marketing
|
6
6
|
|
7
7
|
class << self
|
8
|
+
##
|
9
|
+
# Produces the name of a video game console or platform.
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Faker::Marketing.buzzwords #=> "rubber meets the road"
|
15
|
+
#
|
16
|
+
# @faker.version 1.9.4
|
8
17
|
def buzzwords
|
9
18
|
fetch('marketing.buzzwords')
|
10
19
|
end
|
@@ -7,72 +7,64 @@ module Faker
|
|
7
7
|
NONE = 'none'
|
8
8
|
|
9
9
|
def height(legacy_amount = NOT_GIVEN, amount: rand(10))
|
10
|
-
|
11
|
-
|
12
|
-
amount = legacy_amount
|
10
|
+
warn_for_deprecated_arguments do |keywords|
|
11
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
13
12
|
end
|
14
13
|
|
15
14
|
define_measurement_locale(amount, 'height')
|
16
15
|
end
|
17
16
|
|
18
17
|
def length(legacy_amount = NOT_GIVEN, amount: rand(10))
|
19
|
-
|
20
|
-
|
21
|
-
amount = legacy_amount
|
18
|
+
warn_for_deprecated_arguments do |keywords|
|
19
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
22
20
|
end
|
23
21
|
|
24
22
|
define_measurement_locale(amount, 'length')
|
25
23
|
end
|
26
24
|
|
27
25
|
def volume(legacy_amount = NOT_GIVEN, amount: rand(10))
|
28
|
-
|
29
|
-
|
30
|
-
amount = legacy_amount
|
26
|
+
warn_for_deprecated_arguments do |keywords|
|
27
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
31
28
|
end
|
32
29
|
|
33
30
|
define_measurement_locale(amount, 'volume')
|
34
31
|
end
|
35
32
|
|
36
33
|
def weight(legacy_amount = NOT_GIVEN, amount: rand(10))
|
37
|
-
|
38
|
-
|
39
|
-
amount = legacy_amount
|
34
|
+
warn_for_deprecated_arguments do |keywords|
|
35
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
40
36
|
end
|
41
37
|
|
42
38
|
define_measurement_locale(amount, 'weight')
|
43
39
|
end
|
44
40
|
|
45
41
|
def metric_height(legacy_amount = NOT_GIVEN, amount: rand(10))
|
46
|
-
|
47
|
-
|
48
|
-
amount = legacy_amount
|
42
|
+
warn_for_deprecated_arguments do |keywords|
|
43
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
49
44
|
end
|
50
45
|
|
51
46
|
define_measurement_locale(amount, 'metric_height')
|
52
47
|
end
|
53
48
|
|
54
49
|
def metric_length(legacy_amount = NOT_GIVEN, amount: rand(10))
|
55
|
-
|
56
|
-
|
57
|
-
amount = legacy_amount
|
50
|
+
warn_for_deprecated_arguments do |keywords|
|
51
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
58
52
|
end
|
59
53
|
|
60
54
|
define_measurement_locale(amount, 'metric_length')
|
61
55
|
end
|
62
56
|
|
63
57
|
def metric_volume(legacy_amount = NOT_GIVEN, amount: rand(10))
|
64
|
-
|
65
|
-
|
66
|
-
amount = legacy_amount
|
58
|
+
warn_for_deprecated_arguments do |keywords|
|
59
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
67
60
|
end
|
68
61
|
|
69
62
|
define_measurement_locale(amount, 'metric_volume')
|
70
63
|
end
|
71
64
|
|
72
65
|
def metric_weight(legacy_amount = NOT_GIVEN, amount: rand(10))
|
73
|
-
|
74
|
-
|
75
|
-
amount = legacy_amount
|
66
|
+
warn_for_deprecated_arguments do |keywords|
|
67
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
76
68
|
end
|
77
69
|
|
78
70
|
define_measurement_locale(amount, 'metric_weight')
|