faker 2.15.1 → 2.16.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 +31 -0
- data/History.md +4 -4
- data/README.md +2 -1
- data/lib/faker.rb +1 -1
- data/lib/faker/blockchain/tezos.rb +28 -0
- data/lib/faker/default/app.rb +1 -1
- data/lib/faker/default/avatar.rb +1 -1
- data/lib/faker/default/barcode.rb +33 -22
- data/lib/faker/default/cannabis.rb +10 -0
- data/lib/faker/default/chuck_norris.rb +1 -0
- data/lib/faker/default/code.rb +2 -2
- data/lib/faker/default/company.rb +18 -0
- data/lib/faker/default/driving_licence.rb +3 -2
- data/lib/faker/default/file.rb +6 -4
- data/lib/faker/default/hipster.rb +6 -6
- data/lib/faker/default/internet.rb +227 -2
- data/lib/faker/default/json.rb +3 -2
- data/lib/faker/default/lorem.rb +158 -3
- data/lib/faker/default/lorem_flickr.rb +3 -8
- data/lib/faker/default/lorem_pixel.rb +2 -1
- data/lib/faker/default/markdown.rb +4 -2
- data/lib/faker/default/omniauth.rb +3 -10
- data/lib/faker/default/placeholdit.rb +3 -2
- data/lib/faker/default/string.rb +3 -2
- data/lib/faker/games/touhou.rb +75 -0
- data/lib/faker/movies/star_wars.rb +72 -0
- data/lib/faker/music/rock_band.rb +12 -0
- data/lib/faker/quotes/rajnikanth.rb +1 -0
- data/lib/faker/quotes/shakespeare.rb +34 -0
- data/lib/faker/tv_shows/big_bang_theory.rb +1 -1
- data/lib/faker/tv_shows/suits.rb +1 -1
- data/lib/faker/version.rb +1 -1
- data/lib/locales/en/football.yml +3 -3
- data/lib/locales/en/lebowski.yml +1 -1
- data/lib/locales/en/rock_band.yml +1 -0
- data/lib/locales/en/super_smash_bros.yml +2 -0
- data/lib/locales/en/touhou.yml +839 -0
- data/lib/locales/fr.yml +4 -4
- data/lib/locales/ja.yml +5 -0
- metadata +10 -8
data/lib/faker/default/json.rb
CHANGED
@@ -33,6 +33,8 @@ module Faker
|
|
33
33
|
JSON.generate(hash)
|
34
34
|
end
|
35
35
|
|
36
|
+
# rubocop:disable Metrics/ParameterLists
|
37
|
+
|
36
38
|
##
|
37
39
|
# Produces a random nested JSON formatted string that can take JSON as an additional argument.
|
38
40
|
#
|
@@ -71,9 +73,7 @@ module Faker
|
|
71
73
|
# {"Rick":"Wiza","Bonita":"Bayer","Gardner":"Auer","Felicity":"Abbott"}}}
|
72
74
|
#
|
73
75
|
# @faker.version 1.9.2
|
74
|
-
# rubocop:disable Metrics/ParameterLists
|
75
76
|
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' })
|
76
|
-
# rubocop:enable Metrics/ParameterLists
|
77
77
|
warn_for_deprecated_arguments do |keywords|
|
78
78
|
keywords << :json if legacy_json != NOT_GIVEN
|
79
79
|
end
|
@@ -93,6 +93,7 @@ module Faker
|
|
93
93
|
end
|
94
94
|
JSON.generate(hash)
|
95
95
|
end
|
96
|
+
# rubocop:enable Metrics/ParameterLists
|
96
97
|
|
97
98
|
private
|
98
99
|
|
data/lib/faker/default/lorem.rb
CHANGED
@@ -4,10 +4,32 @@ module Faker
|
|
4
4
|
# Based on Perl's Text::Lorem
|
5
5
|
class Lorem < Base
|
6
6
|
class << self
|
7
|
+
##
|
8
|
+
# Returs the random word
|
9
|
+
# @return [String]
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# Faker::Lorem.word #=> "soluto"
|
13
|
+
#
|
14
|
+
# @faker.version 2.1.3
|
7
15
|
def word
|
8
16
|
sample(translate('faker.lorem.words'))
|
9
17
|
end
|
10
18
|
|
19
|
+
##
|
20
|
+
# Generates random 3 words
|
21
|
+
#
|
22
|
+
# @param number [Integer] Number of words to be generated
|
23
|
+
# @param supplemental [Boolean] Whether to attach supplemental words at the end, default is false
|
24
|
+
#
|
25
|
+
# @return [Array] Array for words
|
26
|
+
#
|
27
|
+
# @example
|
28
|
+
# Faker::Lorem.words #=> ["hic", "quia", "nihil"]
|
29
|
+
# Faker::Lorem.words(number: 4) #=> ["est", "temporibus", "et", "quaerat"]
|
30
|
+
# Faker::Lorem.words(number: 4, supplemental: true) #=> ["nisi", "sit", "allatus", "consequatur"]
|
31
|
+
#
|
32
|
+
# @faker.version 2.1.3
|
11
33
|
def words(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
|
12
34
|
warn_for_deprecated_arguments do |keywords|
|
13
35
|
keywords << :number if legacy_number != NOT_GIVEN
|
@@ -23,6 +45,15 @@ module Faker
|
|
23
45
|
shuffle(word_list)[0, resolved_num]
|
24
46
|
end
|
25
47
|
|
48
|
+
##
|
49
|
+
# Generates single character
|
50
|
+
#
|
51
|
+
# @return [String]
|
52
|
+
#
|
53
|
+
# @example
|
54
|
+
# Faker::Lorem.character #=> "e"
|
55
|
+
#
|
56
|
+
# @faker.version 2.1.3
|
26
57
|
def character
|
27
58
|
sample(Types::CHARACTERS)
|
28
59
|
end
|
@@ -51,13 +82,42 @@ module Faker
|
|
51
82
|
Alphanumeric.alphanumeric(number: number, min_alpha: min_alpha, min_numeric: min_numeric)
|
52
83
|
end
|
53
84
|
|
85
|
+
# rubocop:disable Style/AsciiComments
|
86
|
+
|
87
|
+
##
|
88
|
+
# Generates the emoji
|
89
|
+
#
|
90
|
+
# @return [String]
|
91
|
+
#
|
92
|
+
# @example
|
93
|
+
# Faker::Lorem.multibyte #=> "😀"
|
94
|
+
# Faker::Lorem.multibyte #=> "❤"
|
95
|
+
#
|
96
|
+
# @faker.version 2.1.3
|
54
97
|
def multibyte
|
55
98
|
sample(translate('faker.lorem.multibyte')).pack('C*').force_encoding('utf-8')
|
56
99
|
end
|
100
|
+
# rubocop:enable Style/AsciiComments
|
57
101
|
|
58
102
|
# rubocop:disable Metrics/ParameterLists
|
103
|
+
|
104
|
+
##
|
105
|
+
# Generates sentence
|
106
|
+
#
|
107
|
+
# @param word_count [Integer] How many words should be there in a sentence, default to 4
|
108
|
+
# @param supplemental [Boolean] Add supplemental words, default to false
|
109
|
+
# @param random_words_to_add [Integer] Add any random words, default to 0
|
110
|
+
#
|
111
|
+
# @return [String]
|
112
|
+
#
|
113
|
+
# @example
|
114
|
+
# Faker::Lorem.sentence #=> "Magnam qui aut quidem."
|
115
|
+
# Faker::Lorem.sentence(word_count: 5) #=> "Voluptas rerum aut aliquam velit."
|
116
|
+
# Faker::Lorem.sentence(word_count: 5, supplemental: true) #=> "Aut viscus curtus votum iusto."
|
117
|
+
# Faker::Lorem.sentence(word_count: 5, supplemental: true, random_words_to_add:2) #=> "Crinis quo cruentus velit animi vomer."
|
118
|
+
#
|
119
|
+
# @faker.version 2.1.3
|
59
120
|
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)
|
60
|
-
# rubocop:enable Metrics/ParameterLists
|
61
121
|
warn_for_deprecated_arguments do |keywords|
|
62
122
|
keywords << :word_count if legacy_word_count != NOT_GIVEN
|
63
123
|
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
@@ -66,7 +126,22 @@ module Faker
|
|
66
126
|
|
67
127
|
words(number: word_count + rand(random_words_to_add.to_i), supplemental: supplemental).join(locale_space).capitalize + locale_period
|
68
128
|
end
|
129
|
+
# rubocop:enable Metrics/ParameterLists
|
69
130
|
|
131
|
+
##
|
132
|
+
# Generates three sentences
|
133
|
+
#
|
134
|
+
# @param number [Integer] How many sentences to be generated, default to 3
|
135
|
+
# @param supplemental [Boolean] Should add supplemental words, defaults to false
|
136
|
+
#
|
137
|
+
# @return [Array] Returns array for sentences.
|
138
|
+
#
|
139
|
+
# @example
|
140
|
+
# Faker::Lorem.sentences #=> ["Possimus non tenetur.", "Nulla non excepturi.", "Quisquam rerum facilis."]
|
141
|
+
# Faker::Lorem.sentences(number: 2) #=> ["Nulla est natus.", "Perferendis autem cum."]
|
142
|
+
# Faker::Lorem.sentences(number: 2, supplemental: true) #=> ["Cito cena ad.", "Solvo animus allatus."]
|
143
|
+
#
|
144
|
+
# @faker.version 2.1.3
|
70
145
|
def sentences(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
|
71
146
|
warn_for_deprecated_arguments do |keywords|
|
72
147
|
keywords << :number if legacy_number != NOT_GIVEN
|
@@ -77,8 +152,28 @@ module Faker
|
|
77
152
|
end
|
78
153
|
|
79
154
|
# rubocop:disable Metrics/ParameterLists
|
155
|
+
|
156
|
+
##
|
157
|
+
# Generates three sentence paragraph
|
158
|
+
#
|
159
|
+
# @param sentence_count [Integer] Number of sentences in the paragraph
|
160
|
+
# @param supplemental [Boolean]
|
161
|
+
# @param random_sentences_to_add [Integer]
|
162
|
+
#
|
163
|
+
# @return [String]
|
164
|
+
#
|
165
|
+
# @example
|
166
|
+
# Faker::Lorem.paragraph
|
167
|
+
# #=> "Impedit et est. Aliquid deleniti necessitatibus. Et aspernatur minima."
|
168
|
+
# Faker::Lorem.paragraph(sentence_count: 2)
|
169
|
+
# #=> "Rerum fugit vitae. Et atque autem."
|
170
|
+
# Faker::Lorem.paragraph(sentence_count: 2, supplemental: true)
|
171
|
+
# #=> "Terreo coerceo utor. Vester sunt cogito."
|
172
|
+
# Faker::Lorem.paragraph(sentence_count: 2, supplemental: true, random_sentences_to_add: 2)
|
173
|
+
# #=> "Texo tantillus tamisium. Tribuo amissio tamisium. Facere aut canis."
|
174
|
+
#
|
175
|
+
# @faker.version 2.1.3
|
80
176
|
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)
|
81
|
-
# rubocop:enable Metrics/ParameterLists
|
82
177
|
warn_for_deprecated_arguments do |keywords|
|
83
178
|
keywords << :sentence_count if legacy_sentence_count != NOT_GIVEN
|
84
179
|
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
@@ -87,7 +182,22 @@ module Faker
|
|
87
182
|
|
88
183
|
sentences(number: resolve(sentence_count) + rand(random_sentences_to_add.to_i), supplemental: supplemental).join(locale_space)
|
89
184
|
end
|
185
|
+
# rubocop:enable Metrics/ParameterLists
|
90
186
|
|
187
|
+
##
|
188
|
+
# Generates three paragraphs
|
189
|
+
#
|
190
|
+
# @param number [Integer]
|
191
|
+
# @param supplemental [Boolean]
|
192
|
+
#
|
193
|
+
# @return [Array]
|
194
|
+
#
|
195
|
+
# @example
|
196
|
+
# Faker::Lorem.paragraphs
|
197
|
+
# Faker::Lorem.paragraphs(number:2)
|
198
|
+
# Faker::Lorem.paragraphs(number:2, supplemental: true)
|
199
|
+
#
|
200
|
+
# @faker.version 2.1.3
|
91
201
|
def paragraphs(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
|
92
202
|
warn_for_deprecated_arguments do |keywords|
|
93
203
|
keywords << :number if legacy_number != NOT_GIVEN
|
@@ -99,6 +209,20 @@ module Faker
|
|
99
209
|
1.upto(resolve(number)).collect { paragraph(sentence_count: 3, supplemental: supplemental) }
|
100
210
|
end
|
101
211
|
|
212
|
+
##
|
213
|
+
# Generates paragraph with 256 characters
|
214
|
+
#
|
215
|
+
# @param number [Integer]
|
216
|
+
# @param supplemental [Boolean]
|
217
|
+
#
|
218
|
+
# @return [String]
|
219
|
+
#
|
220
|
+
# @example
|
221
|
+
# Faker::Lorem.paragraph_by_chars
|
222
|
+
# Faker::Lorem.paragraph_by_chars(number: 20) #=> "Sit modi alias. Imp."
|
223
|
+
# Faker::Lorem.paragraph_by_chars(number: 20, supplemental: true) #=> "Certus aveho admove."
|
224
|
+
#
|
225
|
+
# @faker.version 2.1.3
|
102
226
|
def paragraph_by_chars(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 256, supplemental: false)
|
103
227
|
warn_for_deprecated_arguments do |keywords|
|
104
228
|
keywords << :number if legacy_number != NOT_GIVEN
|
@@ -113,8 +237,24 @@ module Faker
|
|
113
237
|
end
|
114
238
|
|
115
239
|
# rubocop:disable Metrics/ParameterLists
|
240
|
+
|
241
|
+
##
|
242
|
+
# Returns the question with 4 words
|
243
|
+
#
|
244
|
+
# @param word_count [Integer]
|
245
|
+
# @param supplemental [Boolean]
|
246
|
+
# @param random_words_to_add [Integer]
|
247
|
+
#
|
248
|
+
# @return [String]
|
249
|
+
#
|
250
|
+
# @example
|
251
|
+
# Faker::Lorem.question #=> "Natus deleniti sequi laudantium?"
|
252
|
+
# Faker::Lorem.question(word_count: 2) #=> "Quo ut?"
|
253
|
+
# Faker::Lorem.question(word_count: 2, supplemental: true) #=> "Terga consequatur?"
|
254
|
+
# Faker::Lorem.question(word_count: 2, supplemental: true, random_words_to_add: 2) #=> "Depulso uter ut?"
|
255
|
+
#
|
256
|
+
# @faker.version 2.1.3
|
116
257
|
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)
|
117
|
-
# rubocop:enable Metrics/ParameterLists
|
118
258
|
warn_for_deprecated_arguments do |keywords|
|
119
259
|
keywords << :word_count if legacy_word_count != NOT_GIVEN
|
120
260
|
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
@@ -123,7 +263,22 @@ module Faker
|
|
123
263
|
|
124
264
|
words(number: word_count + rand(random_words_to_add), supplemental: supplemental).join(' ').capitalize + locale_question_mark
|
125
265
|
end
|
266
|
+
# rubocop:enable Metrics/ParameterLists
|
126
267
|
|
268
|
+
##
|
269
|
+
# Generates array of three questions
|
270
|
+
#
|
271
|
+
# @param number [Integer]
|
272
|
+
# @param supplemental [Boolean]
|
273
|
+
#
|
274
|
+
# @return [Array]
|
275
|
+
#
|
276
|
+
# @example
|
277
|
+
# Faker::Lorem.questions #=> ["Amet culpa enim?", "Voluptatem deleniti numquam?", "Veniam non cum?"]
|
278
|
+
# Faker::Lorem.questions(number: 2) #=> ["Minus occaecati nobis?", "Veniam et alias?"]
|
279
|
+
# Faker::Lorem.questions(number: 2, supplemental: true) #=> ["Acceptus subito cetera?", "Aro sulum cubicularis?"]
|
280
|
+
#
|
281
|
+
# @faker.version 2.1.3
|
127
282
|
def questions(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
|
128
283
|
warn_for_deprecated_arguments do |keywords|
|
129
284
|
keywords << :number if legacy_number != NOT_GIVEN
|
@@ -5,6 +5,8 @@ module Faker
|
|
5
5
|
class << self
|
6
6
|
SUPPORTED_COLORIZATIONS = %w[red green blue].freeze
|
7
7
|
|
8
|
+
# rubocop:disable Metrics/ParameterLists
|
9
|
+
|
8
10
|
##
|
9
11
|
# Produces a random image URL from loremflickr.com.
|
10
12
|
#
|
@@ -21,9 +23,7 @@ module Faker
|
|
21
23
|
# Faker::LoremFlickr.image(size: "50x60", search_terms: ['sports', 'fitness'], match_all: true) #=> "https://loremflickr.com/50/60/sports,fitness/all"
|
22
24
|
#
|
23
25
|
# @faker.version 1.9.0
|
24
|
-
# rubocop:disable Metrics/ParameterLists
|
25
26
|
def image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: [], match_all: false)
|
26
|
-
# rubocop:enable Metrics/ParameterLists
|
27
27
|
warn_for_deprecated_arguments do |keywords|
|
28
28
|
keywords << :size if legacy_size != NOT_GIVEN
|
29
29
|
keywords << :search_terms if legacy_search_terms != NOT_GIVEN
|
@@ -49,9 +49,7 @@ module Faker
|
|
49
49
|
# Faker::LoremFlickr.grayscale_image(size: "50x60", search_terms: ['sports', 'fitness'], match_all: true) #=> "https://loremflickr.com/g/50/60/sports,fitness/all"
|
50
50
|
#
|
51
51
|
# @faker.version 1.9.0
|
52
|
-
# rubocop:disable Metrics/ParameterLists
|
53
52
|
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)
|
54
|
-
# rubocop:enable Metrics/ParameterLists
|
55
53
|
warn_for_deprecated_arguments do |keywords|
|
56
54
|
keywords << :size if legacy_size != NOT_GIVEN
|
57
55
|
keywords << :search_terms if legacy_search_terms != NOT_GIVEN
|
@@ -79,9 +77,7 @@ module Faker
|
|
79
77
|
# Faker::LoremFlickr.pixelated_image(size: "50x60", search_terms: ['sports', 'fitness'], match_all: true) #=> "https://loremflickr.com/p/50/60/sports,fitness/all"
|
80
78
|
#
|
81
79
|
# @faker.version 1.9.0
|
82
|
-
# rubocop:disable Metrics/ParameterLists
|
83
80
|
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)
|
84
|
-
# rubocop:enable Metrics/ParameterLists
|
85
81
|
warn_for_deprecated_arguments do |keywords|
|
86
82
|
keywords << :size if legacy_size != NOT_GIVEN
|
87
83
|
keywords << :search_terms if legacy_search_terms != NOT_GIVEN
|
@@ -110,9 +106,7 @@ module Faker
|
|
110
106
|
# Faker::LoremFlickr.image(size: "50x60", color: 'blue', search_terms: ['sports', 'fitness'], match_all: true) #=> "https://loremflickr.com/blue/50/60/sports,fitness/all"
|
111
107
|
#
|
112
108
|
# @faker.version 1.9.0
|
113
|
-
# rubocop:disable Metrics/ParameterLists
|
114
109
|
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)
|
115
|
-
# rubocop:enable Metrics/ParameterLists
|
116
110
|
warn_for_deprecated_arguments do |keywords|
|
117
111
|
keywords << :size if legacy_size != NOT_GIVEN
|
118
112
|
keywords << :color if legacy_color != NOT_GIVEN
|
@@ -125,6 +119,7 @@ module Faker
|
|
125
119
|
|
126
120
|
build_url(size, color, search_terms, match_all)
|
127
121
|
end
|
122
|
+
# rubocop:enable Metrics/ParameterLists
|
128
123
|
|
129
124
|
private
|
130
125
|
|
@@ -17,6 +17,8 @@ module Faker
|
|
17
17
|
technics
|
18
18
|
transport].freeze
|
19
19
|
|
20
|
+
# rubocop:disable Metrics/ParameterLists
|
21
|
+
|
20
22
|
##
|
21
23
|
# Produces a random image URL from lorempixel.com.
|
22
24
|
#
|
@@ -39,7 +41,6 @@ module Faker
|
|
39
41
|
# Faker::LoremPixel.image(secure: false) #=> "http://lorempixel.com/300/300"
|
40
42
|
#
|
41
43
|
# @faker.version 1.7.0
|
42
|
-
# rubocop:disable Metrics/ParameterLists
|
43
44
|
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)
|
44
45
|
warn_for_deprecated_arguments do |keywords|
|
45
46
|
keywords << :size if legacy_size != NOT_GIVEN
|
@@ -117,9 +117,11 @@ module Faker
|
|
117
117
|
end
|
118
118
|
|
119
119
|
##
|
120
|
-
# Produces a random method from the methods above
|
120
|
+
# Produces a random method from the methods above, excluding the methods listed in the arguments.
|
121
|
+
#
|
122
|
+
# @overload random(methods)
|
123
|
+
# @param methods [Symbol] Specify which methods to exclude.
|
121
124
|
#
|
122
|
-
# @param methods [Symbol] Specify which methods to use.
|
123
125
|
# @return [String, Array<String>]
|
124
126
|
#
|
125
127
|
# @example
|
@@ -17,6 +17,8 @@ module Faker
|
|
17
17
|
end
|
18
18
|
|
19
19
|
class << self
|
20
|
+
# rubocop:disable Metrics/ParameterLists
|
21
|
+
|
20
22
|
##
|
21
23
|
# Generate a mock Omniauth response from Google.
|
22
24
|
#
|
@@ -27,9 +29,7 @@ module Faker
|
|
27
29
|
# @return [Hash] An auth hash in the format provided by omniauth-google.
|
28
30
|
#
|
29
31
|
# @faker.version 1.8.0
|
30
|
-
# rubocop:disable Metrics/ParameterLists
|
31
32
|
def google(legacy_name = NOT_GIVEN, legacy_email = NOT_GIVEN, legacy_uid = NOT_GIVEN, name: nil, email: nil, uid: Number.number(digits: 9).to_s)
|
32
|
-
# rubocop:enable Metrics/ParameterLists
|
33
33
|
warn_for_deprecated_arguments do |keywords|
|
34
34
|
keywords << :name if legacy_name != NOT_GIVEN
|
35
35
|
keywords << :email if legacy_email != NOT_GIVEN
|
@@ -95,9 +95,7 @@ module Faker
|
|
95
95
|
# @return [Hash] An auth hash in the format provided by omniauth-facebook.
|
96
96
|
#
|
97
97
|
# @faker.version 1.8.0
|
98
|
-
# rubocop:disable Metrics/ParameterLists
|
99
98
|
def facebook(legacy_name = NOT_GIVEN, legacy_email = NOT_GIVEN, legacy_username = NOT_GIVEN, legacy_uid = NOT_GIVEN, name: nil, email: nil, username: nil, uid: Number.number(digits: 7).to_s)
|
100
|
-
# rubocop:enable Metrics/ParameterLists
|
101
99
|
warn_for_deprecated_arguments do |keywords|
|
102
100
|
keywords << :name if legacy_name != NOT_GIVEN
|
103
101
|
keywords << :email if legacy_email != NOT_GIVEN
|
@@ -156,9 +154,7 @@ module Faker
|
|
156
154
|
# @return [Hash] An auth hash in the format provided by omniauth-twitter.
|
157
155
|
#
|
158
156
|
# @faker.version 1.8.0
|
159
|
-
# rubocop:disable Metrics/ParameterLists
|
160
157
|
def twitter(legacy_name = NOT_GIVEN, legacy_nickname = NOT_GIVEN, legacy_uid = NOT_GIVEN, name: nil, nickname: nil, uid: Number.number(digits: 6).to_s)
|
161
|
-
# rubocop:enable Metrics/ParameterLists
|
162
158
|
warn_for_deprecated_arguments do |keywords|
|
163
159
|
keywords << :name if legacy_name != NOT_GIVEN
|
164
160
|
keywords << :nickname if legacy_nickname != NOT_GIVEN
|
@@ -247,9 +243,7 @@ module Faker
|
|
247
243
|
# @return [Hash] An auth hash in the format provided by omniauth-linkedin.
|
248
244
|
#
|
249
245
|
# @faker.version 1.8.0
|
250
|
-
# rubocop:disable Metrics/ParameterLists
|
251
246
|
def linkedin(legacy_name = NOT_GIVEN, legacy_email = NOT_GIVEN, legacy_uid = NOT_GIVEN, name: nil, email: nil, uid: Number.number(digits: 6).to_s)
|
252
|
-
# rubocop:enable Metrics/ParameterLists
|
253
247
|
warn_for_deprecated_arguments do |keywords|
|
254
248
|
keywords << :name if legacy_name != NOT_GIVEN
|
255
249
|
keywords << :email if legacy_email != NOT_GIVEN
|
@@ -328,9 +322,7 @@ module Faker
|
|
328
322
|
# @return [Hash] An auth hash in the format provided by omniauth-github.
|
329
323
|
#
|
330
324
|
# @faker.version 1.8.0
|
331
|
-
# rubocop:disable Metrics/ParameterLists
|
332
325
|
def github(legacy_name = NOT_GIVEN, legacy_email = NOT_GIVEN, legacy_uid = NOT_GIVEN, name: nil, email: nil, uid: Number.number(digits: 8).to_s)
|
333
|
-
# rubocop:enable Metrics/ParameterLists
|
334
326
|
warn_for_deprecated_arguments do |keywords|
|
335
327
|
keywords << :name if legacy_name != NOT_GIVEN
|
336
328
|
keywords << :email if legacy_email != NOT_GIVEN
|
@@ -393,6 +385,7 @@ module Faker
|
|
393
385
|
}
|
394
386
|
}
|
395
387
|
end
|
388
|
+
# rubocop:enable Metrics/ParameterLists
|
396
389
|
|
397
390
|
##
|
398
391
|
# Generate a mock Omniauth response from Apple.
|
@@ -5,6 +5,8 @@ module Faker
|
|
5
5
|
class << self
|
6
6
|
SUPPORTED_FORMATS = %w[png jpg gif jpeg].freeze
|
7
7
|
|
8
|
+
# rubocop:disable Metrics/ParameterLists
|
9
|
+
|
8
10
|
##
|
9
11
|
# Produces a random placeholder image from https://placehold.it.
|
10
12
|
#
|
@@ -26,9 +28,7 @@ module Faker
|
|
26
28
|
# Faker::Placeholdit.image(size: '50x50', format: 'jpg', background_color: 'ffffff', text_color: '000', text: 'Some Custom Text') #=> "https://placehold.it/50x50.jpg/ffffff/000?text=Some Custom Text"
|
27
29
|
#
|
28
30
|
# @faker.version 1.6.0
|
29
|
-
# rubocop:disable Metrics/ParameterLists
|
30
31
|
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)
|
31
|
-
# rubocop:enable Metrics/ParameterLists
|
32
32
|
warn_for_deprecated_arguments do |keywords|
|
33
33
|
keywords << :size if legacy_size != NOT_GIVEN
|
34
34
|
keywords << :format if legacy_format != NOT_GIVEN
|
@@ -51,6 +51,7 @@ module Faker
|
|
51
51
|
image_url += "?text=#{text}" if text
|
52
52
|
image_url
|
53
53
|
end
|
54
|
+
# rubocop:enable Metrics/ParameterLists
|
54
55
|
|
55
56
|
private
|
56
57
|
|
data/lib/faker/default/string.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
module Faker
|
4
4
|
class String < Base
|
5
5
|
class << self
|
6
|
+
# rubocop:disable Style/AsciiComments
|
7
|
+
|
6
8
|
##
|
7
9
|
# Produces a random UTF-8 string with optional nested length selectors.
|
8
10
|
#
|
@@ -10,13 +12,11 @@ module Faker
|
|
10
12
|
# @return [String]
|
11
13
|
#
|
12
14
|
# @example
|
13
|
-
# rubocop:disable Style/AsciiComments
|
14
15
|
# Faker::String.random #=> "3 뇦\u0017&y\u{3A109}$8^4* 녹豿4좘툢ꔾ쉙6ɉ\uA6 8TN畀챵|\"3쇤Ŵ"
|
15
16
|
# Faker::String.random(length: 4) #=> "⼨%0*"
|
16
17
|
# Faker::String.random(length: 3..12) #=> "\u{69FDC};秨툫"
|
17
18
|
# Faker::String.random(length: [0, 6]) #=> "I轤𣴒P溟L"
|
18
19
|
# Faker::String.random(length: [1, (2..5), [3, 6], nil]) #=> "葓L#ћ"
|
19
|
-
# rubocop:enable Style/AsciiComments
|
20
20
|
#
|
21
21
|
# @faker.version 1.9.0
|
22
22
|
def random(legacy_length = NOT_GIVEN, length: 32)
|
@@ -26,6 +26,7 @@ module Faker
|
|
26
26
|
|
27
27
|
utf8string select_a length
|
28
28
|
end
|
29
|
+
# rubocop:enable Style/AsciiComments
|
29
30
|
|
30
31
|
private
|
31
32
|
|