faker 2.1.0 → 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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +93 -3
  3. data/README.md +3 -3
  4. data/lib/faker.rb +56 -1
  5. data/lib/faker/blockchain/tezos.rb +6 -6
  6. data/lib/faker/books/dune.rb +10 -2
  7. data/lib/faker/books/lovecraft.rb +38 -7
  8. data/lib/faker/default/address.rb +25 -5
  9. data/lib/faker/default/alphanumeric.rb +39 -7
  10. data/lib/faker/default/app.rb +9 -1
  11. data/lib/faker/default/avatar.rb +11 -1
  12. data/lib/faker/default/bank.rb +10 -2
  13. data/lib/faker/default/boolean.rb +5 -1
  14. data/lib/faker/default/chile_rut.rb +12 -2
  15. data/lib/faker/default/code.rb +16 -3
  16. data/lib/faker/default/commerce.rb +17 -3
  17. data/lib/faker/default/company.rb +10 -2
  18. data/lib/faker/default/crypto_coin.rb +15 -3
  19. data/lib/faker/default/date.rb +37 -5
  20. data/lib/faker/default/demographic.rb +5 -1
  21. data/lib/faker/default/driving_licence.rb +10 -4
  22. data/lib/faker/default/file.rb +19 -2
  23. data/lib/faker/default/fillmurray.rb +9 -1
  24. data/lib/faker/default/finance.rb +5 -1
  25. data/lib/faker/default/hipster.rb +45 -6
  26. data/lib/faker/default/id_number.rb +48 -3
  27. data/lib/faker/default/internet.rb +89 -13
  28. data/lib/faker/default/invoice.rb +16 -3
  29. data/lib/faker/default/json.rb +19 -2
  30. data/lib/faker/default/lorem.rb +80 -10
  31. data/lib/faker/default/lorem_flickr.rb +38 -5
  32. data/lib/faker/default/lorem_pixel.rb +10 -1
  33. data/lib/faker/default/markdown.rb +6 -1
  34. data/lib/faker/default/measurement.rb +40 -8
  35. data/lib/faker/default/name.rb +5 -1
  36. data/lib/faker/default/nhs.rb +5 -1
  37. data/lib/faker/default/number.rb +56 -11
  38. data/lib/faker/default/omniauth.rb +50 -9
  39. data/lib/faker/default/phone_number.rb +5 -1
  40. data/lib/faker/default/placeholdit.rb +11 -1
  41. data/lib/faker/default/relationship.rb +5 -1
  42. data/lib/faker/default/source.rb +18 -3
  43. data/lib/faker/default/string.rb +5 -1
  44. data/lib/faker/default/stripe.rb +20 -4
  45. data/lib/faker/default/time.rb +37 -4
  46. data/lib/faker/default/twitter.rb +32 -18
  47. data/lib/faker/default/types.rb +27 -5
  48. data/lib/faker/default/vehicle.rb +17 -4
  49. data/lib/faker/default/world_cup.rb +11 -2
  50. data/lib/faker/games/dota.rb +5 -1
  51. data/lib/faker/movies/star_wars.rb +6 -4
  52. data/lib/faker/version.rb +1 -1
  53. data/lib/locales/en.yml +0 -49
  54. data/lib/locales/en/science.yml +1 -1
  55. metadata +18 -18
@@ -12,6 +12,9 @@ module Faker
12
12
  ].freeze
13
13
  ZA_RACE_DIGIT = '8'
14
14
  ZA_CITIZENSHIP_DIGITS = %w[0 1].freeze
15
+ BRAZILIAN_ID_FORMAT = /(\d{1,2})(\d{3})(\d{3})([\dX])/.freeze
16
+ BRAZILIAN_ID_FROM = 10_000_000
17
+ BRAZILIAN_ID_TO = 99_999_999
15
18
 
16
19
  class << self
17
20
  def valid
@@ -75,7 +78,11 @@ module Faker
75
78
  [id_number, south_african_id_checksum_digit(id_number)].join
76
79
  end
77
80
 
78
- def brazilian_citizen_number(formatted: false)
81
+ def brazilian_citizen_number(legacy_formatted = NOT_GIVEN, formatted: false)
82
+ warn_for_deprecated_arguments do |keywords|
83
+ keywords << :formatted if legacy_formatted != NOT_GIVEN
84
+ end
85
+
79
86
  digits = Faker::Number.leading_zero_number(digits: 9) until digits&.match(/(\d)((?!\1)\d)+/)
80
87
  first_digit = brazilian_citizen_number_checksum_digit(digits)
81
88
  second_digit = brazilian_citizen_number_checksum_digit(digits + first_digit)
@@ -83,6 +90,21 @@ module Faker
83
90
  formatted ? format('%s.%s.%s-%s', *number.scan(/\d{2,3}/).flatten) : number
84
91
  end
85
92
 
93
+ alias brazilian_cpf brazilian_citizen_number
94
+
95
+ def brazilian_id(legacy_formatted = NOT_GIVEN, formatted: false)
96
+ warn_for_deprecated_arguments do |keywords|
97
+ keywords << :formatted if legacy_formatted != NOT_GIVEN
98
+ end
99
+
100
+ digits = Faker::Number.between(to: BRAZILIAN_ID_FROM, from: BRAZILIAN_ID_TO).to_s
101
+ check_digit = brazilian_id_checksum_digit(digits)
102
+ number = [digits, check_digit].join
103
+ formatted ? format('%s.%s.%s-%s', *number.scan(BRAZILIAN_ID_FORMAT).flatten) : number
104
+ end
105
+
106
+ alias brazilian_rg brazilian_id
107
+
86
108
  private
87
109
 
88
110
  def south_african_id_checksum_digit(id_number)
@@ -104,13 +126,36 @@ module Faker
104
126
  end
105
127
 
106
128
  def brazilian_citizen_number_checksum_digit(digits)
107
- digit_sum = digits.chars.each_with_index.inject(0) do |acc, (digit, i)|
129
+ checksum = brazilian_document_checksum(digits)
130
+ brazilian_document_digit(checksum)
131
+ end
132
+
133
+ def brazilian_id_checksum_digit(digits)
134
+ checksum = brazilian_document_checksum(digits)
135
+ brazilian_document_digit(checksum, id: true)
136
+ end
137
+
138
+ def brazilian_document_checksum(digits)
139
+ digits.chars.each_with_index.inject(0) do |acc, (digit, i)|
108
140
  acc + digit.to_i * (digits.size + 1 - i)
109
141
  end * 10
110
- remainder = digit_sum % 11
142
+ end
143
+
144
+ def brazilian_document_digit(checksum, id = false)
145
+ remainder = checksum % 11
146
+ id ? brazilian_id_digit(remainder) : brazilian_citizen_number_digit(remainder)
147
+ end
148
+
149
+ def brazilian_citizen_number_digit(remainder)
111
150
  remainder == 10 ? '0' : remainder.to_s
112
151
  end
113
152
 
153
+ def brazilian_id_digit(remainder)
154
+ subtraction = 11 - remainder.to_i
155
+ digits = { 10 => 'X', 11 => '0' }
156
+ digits.include?(subtraction) ? digits[subtraction] : subtraction.to_s
157
+ end
158
+
114
159
  def _translate(key)
115
160
  parse("id_number.#{key}")
116
161
  end
@@ -3,7 +3,12 @@
3
3
  module Faker
4
4
  class Internet < Base
5
5
  class << self
6
- def email(name: nil, separators: nil)
6
+ def email(legacy_name = NOT_GIVEN, legacy_separators = NOT_GIVEN, name: nil, separators: nil)
7
+ warn_for_deprecated_arguments do |keywords|
8
+ keywords << :name if legacy_name != NOT_GIVEN
9
+ keywords << :separators if legacy_separators != NOT_GIVEN
10
+ end
11
+
7
12
  if separators
8
13
  [username(specifier: name, separators: separators), domain_name].join('@')
9
14
  else
@@ -11,15 +16,28 @@ module Faker
11
16
  end
12
17
  end
13
18
 
14
- def free_email(name: nil)
19
+ def free_email(legacy_name = NOT_GIVEN, name: nil)
20
+ warn_for_deprecated_arguments do |keywords|
21
+ keywords << :name if legacy_name != NOT_GIVEN
22
+ end
23
+
15
24
  [username(specifier: name), fetch('internet.free_email')].join('@')
16
25
  end
17
26
 
18
- def safe_email(name: nil)
27
+ def safe_email(legacy_name = NOT_GIVEN, name: nil)
28
+ warn_for_deprecated_arguments do |keywords|
29
+ keywords << :name if legacy_name != NOT_GIVEN
30
+ end
31
+
19
32
  [username(specifier: name), 'example.' + sample(%w[org com net])].join('@')
20
33
  end
21
34
 
22
- def username(specifier: nil, separators: %w[. _])
35
+ def username(legacy_specifier = NOT_GIVEN, legacy_separators = NOT_GIVEN, specifier: nil, separators: %w[. _])
36
+ warn_for_deprecated_arguments do |keywords|
37
+ keywords << :specifier if legacy_specifier != NOT_GIVEN
38
+ keywords << :separators if legacy_separators != NOT_GIVEN
39
+ end
40
+
23
41
  with_locale(:en) do
24
42
  return shuffle(specifier.scan(/[[:word:]]+/)).join(sample(separators)).downcase if specifier.respond_to?(:scan)
25
43
 
@@ -55,8 +73,34 @@ module Faker
55
73
  end
56
74
  end
57
75
 
58
- def password(min_length: 8, max_length: 16, mix_case: true, special_characters: false)
59
- temp = Lorem.characters(number: min_length)
76
+ ##
77
+ # Produces a randomized string of characters
78
+ #
79
+ # @param [Integer] min_length
80
+ # @param [Integer] max_length
81
+ # @param [Boolean] mix_case
82
+ # @param [Boolean] special_characters
83
+ #
84
+ # @return [String]
85
+ #
86
+ # @example Faker::Internet.password #=> "Vg5mSvY1UeRg7"
87
+ # @example Faker::Internet.password(min_length: 8) #=> "YfGjIk0hGzDqS0"
88
+ # @example Faker::Internet.password(min_length: 10, max_length: 20) #=> "EoC9ShWd1hWq4vBgFw"
89
+ # @example Faker::Internet.password(min_length: 10, max_length: 20, mix_case: true) #=> "3k5qS15aNmG"
90
+ # @example Faker::Internet.password(min_length: 10, max_length: 20, mix_case: true, special_characters: true) #=> "*%NkOnJsH4"
91
+ #
92
+ # @faker.version 2.1.3
93
+ # rubocop:disable Metrics/ParameterLists
94
+ def password(legacy_min_length = NOT_GIVEN, legacy_max_length = NOT_GIVEN, legacy_mix_case = NOT_GIVEN, legacy_special_characters = NOT_GIVEN, min_length: 8, max_length: 16, mix_case: true, special_characters: false)
95
+ warn_for_deprecated_arguments do |keywords|
96
+ keywords << :min_length if legacy_min_length != NOT_GIVEN
97
+ keywords << :max_length if legacy_max_length != NOT_GIVEN
98
+ keywords << :mix_case if legacy_mix_case != NOT_GIVEN
99
+ keywords << :special_characters if legacy_special_characters != NOT_GIVEN
100
+ end
101
+
102
+ min_alpha = mix_case ? 2 : 0
103
+ temp = Lorem.characters(number: min_length, min_alpha: min_alpha)
60
104
  diff_length = max_length - min_length
61
105
 
62
106
  if diff_length.positive?
@@ -65,8 +109,12 @@ module Faker
65
109
  end
66
110
 
67
111
  if mix_case
112
+ alpha_count = 0
68
113
  temp.chars.each_with_index do |char, index|
69
- temp[index] = char.upcase if index.even?
114
+ if char =~ /[[:alpha:]]/
115
+ temp[index] = char.upcase if alpha_count.even?
116
+ alpha_count += 1
117
+ end
70
118
  end
71
119
  end
72
120
 
@@ -80,7 +128,11 @@ module Faker
80
128
  temp
81
129
  end
82
130
 
83
- def domain_name(subdomain: false)
131
+ def domain_name(legacy_subdomain = NOT_GIVEN, subdomain: false)
132
+ warn_for_deprecated_arguments do |keywords|
133
+ keywords << :subdomain if legacy_subdomain != NOT_GIVEN
134
+ end
135
+
84
136
  with_locale(:en) do
85
137
  domain_elements = [Char.prepare(domain_word), domain_suffix]
86
138
  domain_elements.unshift(Char.prepare(domain_word)) if subdomain
@@ -88,7 +140,11 @@ module Faker
88
140
  end
89
141
  end
90
142
 
91
- def fix_umlauts(string: '')
143
+ def fix_umlauts(legacy_string = NOT_GIVEN, string: '')
144
+ warn_for_deprecated_arguments do |keywords|
145
+ keywords << :string if legacy_string != NOT_GIVEN
146
+ end
147
+
92
148
  Char.fix_umlauts(string)
93
149
  end
94
150
 
@@ -100,7 +156,11 @@ module Faker
100
156
  fetch('internet.domain_suffix')
101
157
  end
102
158
 
103
- def mac_address(prefix: '')
159
+ def mac_address(legacy_prefix = NOT_GIVEN, prefix: '')
160
+ warn_for_deprecated_arguments do |keywords|
161
+ keywords << :prefix if legacy_prefix != NOT_GIVEN
162
+ end
163
+
104
164
  prefix_digits = prefix.split(':').map { |d| d.to_i(16) }
105
165
  address_digits = Array.new((6 - prefix_digits.size)) { rand(256) }
106
166
  (prefix_digits + address_digits).map { |d| format('%02x', d) }.join(':')
@@ -174,11 +234,23 @@ module Faker
174
234
  "#{ip_v6_address}/#{rand(1..127)}"
175
235
  end
176
236
 
177
- def url(host: domain_name, path: "/#{username}", scheme: 'http')
237
+ def url(legacy_host = NOT_GIVEN, legacy_path = NOT_GIVEN, legacy_scheme = NOT_GIVEN, host: domain_name, path: "/#{username}", scheme: 'http')
238
+ # rubocop:enable Metrics/ParameterLists
239
+ warn_for_deprecated_arguments do |keywords|
240
+ keywords << :host if legacy_host != NOT_GIVEN
241
+ keywords << :path if legacy_path != NOT_GIVEN
242
+ keywords << :scheme if legacy_scheme != NOT_GIVEN
243
+ end
244
+
178
245
  "#{scheme}://#{host}#{path}"
179
246
  end
180
247
 
181
- def slug(words: nil, glue: nil)
248
+ def slug(legacy_words = NOT_GIVEN, legacy_glue = NOT_GIVEN, words: nil, glue: nil)
249
+ warn_for_deprecated_arguments do |keywords|
250
+ keywords << :words if legacy_words != NOT_GIVEN
251
+ keywords << :glue if legacy_glue != NOT_GIVEN
252
+ end
253
+
182
254
  glue ||= sample(%w[- _])
183
255
  (words || Faker::Lorem.words(number: 2).join(' ')).delete(',.').gsub(' ', glue).downcase
184
256
  end
@@ -187,7 +259,11 @@ module Faker
187
259
  shuffle(rand(16**64).to_s(16).rjust(64, '0').chars.to_a).join
188
260
  end
189
261
 
190
- def user_agent(vendor: nil)
262
+ def user_agent(legacy_vendor = NOT_GIVEN, vendor: nil)
263
+ warn_for_deprecated_arguments do |keywords|
264
+ keywords << :vendor if legacy_vendor != NOT_GIVEN
265
+ end
266
+
191
267
  agent_hash = translate('faker.internet.user_agent')
192
268
  agents = vendor.respond_to?(:to_sym) && agent_hash[vendor.to_sym] || agent_hash[sample(agent_hash.keys)]
193
269
  sample(agents)
@@ -6,13 +6,22 @@ module Faker
6
6
 
7
7
  class << self
8
8
  # Generate random amount between values with 2 decimals
9
- def amount_between(from: 0, to: 0)
9
+ def amount_between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 0, to: 0)
10
+ warn_for_deprecated_arguments do |keywords|
11
+ keywords << :from if legacy_from != NOT_GIVEN
12
+ keywords << :to if legacy_to != NOT_GIVEN
13
+ end
14
+
10
15
  Faker::Base.rand_in_range(from, to).round(2)
11
16
  end
12
17
 
13
18
  # International bank slip reference https://en.wikipedia.org/wiki/Creditor_Reference
14
19
  # ref is optional so that we can create unit tests
15
- def creditor_reference(ref: '')
20
+ def creditor_reference(legacy_ref = NOT_GIVEN, ref: '')
21
+ warn_for_deprecated_arguments do |keywords|
22
+ keywords << :ref if legacy_ref != NOT_GIVEN
23
+ end
24
+
16
25
  ref = reference if ref.empty?
17
26
 
18
27
  'RF' + iban_checksum('RF', ref) + ref
@@ -20,7 +29,11 @@ module Faker
20
29
 
21
30
  # Payment references have some rules in certain countries
22
31
  # ref is optional so that we can create unit tests
23
- def reference(ref: '')
32
+ def reference(legacy_ref = NOT_GIVEN, ref: '')
33
+ warn_for_deprecated_arguments do |keywords|
34
+ keywords << :ref if legacy_ref != NOT_GIVEN
35
+ end
36
+
24
37
  pattern = fetch('invoice.reference.pattern')
25
38
 
26
39
  ref = Base.regexify(/#{pattern}/) if ref.empty?
@@ -3,7 +3,12 @@ module Faker
3
3
  require 'json'
4
4
 
5
5
  class << self
6
- def shallow_json(width: 3, options: { key: 'Name.first_name', value: 'Name.first_name' })
6
+ def shallow_json(legacy_width = NOT_GIVEN, legacy_options = NOT_GIVEN, width: 3, options: { key: 'Name.first_name', value: 'Name.first_name' })
7
+ warn_for_deprecated_arguments do |keywords|
8
+ keywords << :width if legacy_width != NOT_GIVEN
9
+ keywords << :options if legacy_options != NOT_GIVEN
10
+ end
11
+
7
12
  options[:key] = 'Faker::' + options[:key]
8
13
  options[:value] = 'Faker::' + options[:value]
9
14
 
@@ -11,7 +16,19 @@ module Faker
11
16
  JSON.generate(hash)
12
17
  end
13
18
 
14
- def add_depth_to_json(json: shallow_json, width: 3, options: { key: 'Name.first_name', value: 'Name.first_name' })
19
+ # rubocop:disable Metrics/ParameterLists
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' })
21
+ # rubocop:enable Metrics/ParameterLists
22
+ warn_for_deprecated_arguments do |keywords|
23
+ keywords << :json if legacy_json != NOT_GIVEN
24
+ end
25
+ warn_for_deprecated_arguments do |keywords|
26
+ keywords << :width if legacy_width != NOT_GIVEN
27
+ end
28
+ warn_for_deprecated_arguments do |keywords|
29
+ keywords << :options if legacy_options != NOT_GIVEN
30
+ end
31
+
15
32
  options[:key] = 'Faker::' + options[:key]
16
33
  options[:value] = 'Faker::' + options[:value]
17
34
 
@@ -8,7 +8,12 @@ module Faker
8
8
  sample(translate('faker.lorem.words'))
9
9
  end
10
10
 
11
- def words(number: 3, supplemental: false)
11
+ def words(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
12
+ warn_for_deprecated_arguments do |keywords|
13
+ keywords << :number if legacy_number != NOT_GIVEN
14
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
15
+ end
16
+
12
17
  resolved_num = resolve(number)
13
18
  word_list = (
14
19
  translate('faker.lorem.words') +
@@ -22,31 +27,83 @@ module Faker
22
27
  sample(Types::CHARACTERS)
23
28
  end
24
29
 
25
- def characters(number: 255)
26
- Alphanumeric.alphanumeric(number: number)
30
+ ##
31
+ # Produces a random string of alphanumeric characters
32
+ #
33
+ # @param [Integer] number
34
+ # @param [Integer] min_alpha
35
+ # @param [Integer] min_numeric
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example Faker::Lorem.characters #=> "uw1ep04lhs0c4d931n1jmrspprf5wrj85fefue0y7y6m56b6omquh7br7dhqijwlawejpl765nb1716idmp3xnfo85v349pzy2o9rir23y2qhflwr71c1585fnynguiphkjm8p0vktwitcsm16lny7jzp9t4drwav3qmhz4yjq4k04x14gl6p148hulyqioo72tf8nwrxxcclfypz2lc58lsibgfe5w5p0xv95peafjjmm2frkhdc6duoky0aha"
40
+ # @example Faker::Lorem.characters(number: 10) #=> "ang9cbhoa8"
41
+ # @example Faker::Lorem.characters(number: 10, min_alpha: 4) #=> "ang9cbhoa8"
42
+ # @example Faker::Lorem.characters(number: 10, min_alpha: 4, min_numeric: 1) #=> "ang9cbhoa8"
43
+ #
44
+ # @faker.version 2.1.3
45
+ def characters(legacy_number = NOT_GIVEN, number: 255, min_alpha: 0, min_numeric: 0)
46
+ warn_for_deprecated_arguments do |keywords|
47
+ keywords << :number if legacy_number != NOT_GIVEN
48
+ end
49
+
50
+ Alphanumeric.alphanumeric(number: number, min_alpha: min_alpha, min_numeric: min_numeric)
27
51
  end
28
52
 
29
53
  def multibyte
30
54
  sample(translate('faker.lorem.multibyte')).pack('C*').force_encoding('utf-8')
31
55
  end
32
56
 
33
- def sentence(word_count: 4, supplemental: false, random_words_to_add: 0)
57
+ # rubocop:disable Metrics/ParameterLists
58
+ 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)
59
+ # rubocop:enable Metrics/ParameterLists
60
+ warn_for_deprecated_arguments do |keywords|
61
+ keywords << :word_count if legacy_word_count != NOT_GIVEN
62
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
63
+ keywords << :random_words_to_add if legacy_random_words_to_add != NOT_GIVEN
64
+ end
65
+
34
66
  words(number: word_count + rand(random_words_to_add.to_i), supplemental: supplemental).join(' ').capitalize + locale_period
35
67
  end
36
68
 
37
- def sentences(number: 3, supplemental: false)
69
+ def sentences(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
70
+ warn_for_deprecated_arguments do |keywords|
71
+ keywords << :number if legacy_number != NOT_GIVEN
72
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
73
+ end
74
+
38
75
  1.upto(resolve(number)).collect { sentence(word_count: 3, supplemental: supplemental) }
39
76
  end
40
77
 
41
- def paragraph(sentence_count: 3, supplemental: false, random_sentences_to_add: 0)
78
+ # rubocop:disable Metrics/ParameterLists
79
+ 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)
80
+ # rubocop:enable Metrics/ParameterLists
81
+ warn_for_deprecated_arguments do |keywords|
82
+ keywords << :sentence_count if legacy_sentence_count != NOT_GIVEN
83
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
84
+ keywords << :random_sentences_to_add if legacy_random_sentences_to_add != NOT_GIVEN
85
+ end
86
+
42
87
  sentences(number: resolve(sentence_count) + rand(random_sentences_to_add.to_i), supplemental: supplemental).join(locale_space)
43
88
  end
44
89
 
45
- def paragraphs(number: 3, supplemental: false)
90
+ def paragraphs(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
91
+ warn_for_deprecated_arguments do |keywords|
92
+ keywords << :number if legacy_number != NOT_GIVEN
93
+ end
94
+ warn_for_deprecated_arguments do |keywords|
95
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
96
+ end
97
+
46
98
  1.upto(resolve(number)).collect { paragraph(sentence_count: 3, supplemental: supplemental) }
47
99
  end
48
100
 
49
- def paragraph_by_chars(number: 256, supplemental: false)
101
+ def paragraph_by_chars(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 256, supplemental: false)
102
+ warn_for_deprecated_arguments do |keywords|
103
+ keywords << :number if legacy_number != NOT_GIVEN
104
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
105
+ end
106
+
50
107
  paragraph = paragraph(sentence_count: 3, supplemental: supplemental)
51
108
 
52
109
  paragraph += ' ' + paragraph(sentence_count: 3, supplemental: supplemental) while paragraph.length < number
@@ -54,11 +111,24 @@ module Faker
54
111
  paragraph[0...number - 1] + '.'
55
112
  end
56
113
 
57
- def question(word_count: 4, supplemental: false, random_words_to_add: 0)
114
+ # rubocop:disable Metrics/ParameterLists
115
+ 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)
116
+ # rubocop:enable Metrics/ParameterLists
117
+ warn_for_deprecated_arguments do |keywords|
118
+ keywords << :word_count if legacy_word_count != NOT_GIVEN
119
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
120
+ keywords << :random_words_to_add if legacy_random_words_to_add != NOT_GIVEN
121
+ end
122
+
58
123
  words(number: word_count + rand(random_words_to_add), supplemental: supplemental).join(' ').capitalize + locale_question_mark
59
124
  end
60
125
 
61
- def questions(number: 3, supplemental: false)
126
+ def questions(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
127
+ warn_for_deprecated_arguments do |keywords|
128
+ keywords << :number if legacy_number != NOT_GIVEN
129
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
130
+ end
131
+
62
132
  1.upto(resolve(number)).collect { question(word_count: 3, supplemental: supplemental) }
63
133
  end
64
134