faker 1.9.6 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +386 -6
  3. data/README.md +12 -5
  4. data/lib/faker.rb +56 -1
  5. data/lib/faker/blockchain/aeternity.rb +70 -0
  6. data/lib/faker/blockchain/bitcoin.rb +26 -0
  7. data/lib/faker/blockchain/ethereum.rb +10 -0
  8. data/lib/faker/blockchain/tezos.rb +62 -6
  9. data/lib/faker/books/book.rb +36 -0
  10. data/lib/faker/books/culture_series.rb +49 -0
  11. data/lib/faker/books/dune.rb +66 -5
  12. data/lib/faker/books/lovecraft.rb +221 -18
  13. data/lib/faker/creature/animal.rb +10 -1
  14. data/lib/faker/creature/cat.rb +28 -1
  15. data/lib/faker/creature/dog.rb +73 -1
  16. data/lib/faker/creature/horse.rb +19 -1
  17. data/lib/faker/default/address.rb +25 -5
  18. data/lib/faker/default/alphanumeric.rb +58 -9
  19. data/lib/faker/default/app.rb +55 -1
  20. data/lib/faker/default/appliance.rb +18 -0
  21. data/lib/faker/default/artist.rb +9 -0
  22. data/lib/faker/default/avatar.rb +43 -1
  23. data/lib/faker/default/bank.rb +10 -2
  24. data/lib/faker/default/boolean.rb +16 -1
  25. data/lib/faker/default/cannabis.rb +4 -0
  26. data/lib/faker/default/chile_rut.rb +13 -3
  27. data/lib/faker/default/chuck_norris.rb +1 -1
  28. data/lib/faker/default/code.rb +18 -5
  29. data/lib/faker/default/commerce.rb +18 -4
  30. data/lib/faker/default/company.rb +11 -3
  31. data/lib/faker/default/crypto_coin.rb +21 -4
  32. data/lib/faker/default/date.rb +122 -9
  33. data/lib/faker/default/demographic.rb +5 -1
  34. data/lib/faker/default/dessert.rb +27 -0
  35. data/lib/faker/default/device.rb +56 -2
  36. data/lib/faker/default/driving_licence.rb +13 -7
  37. data/lib/faker/default/educator.rb +0 -3
  38. data/lib/faker/default/electrical_components.rb +27 -0
  39. data/lib/faker/default/file.rb +20 -3
  40. data/lib/faker/default/fillmurray.rb +10 -2
  41. data/lib/faker/default/finance.rb +5 -1
  42. data/lib/faker/default/gender.rb +18 -0
  43. data/lib/faker/default/greek_philosophers.rb +18 -0
  44. data/lib/faker/default/hacker.rb +59 -1
  45. data/lib/faker/default/hipster.rb +55 -16
  46. data/lib/faker/default/house.rb +18 -0
  47. data/lib/faker/default/id_number.rb +85 -11
  48. data/lib/faker/default/industry_segments.rb +36 -0
  49. data/lib/faker/default/internet.rb +107 -22
  50. data/lib/faker/default/invoice.rb +16 -3
  51. data/lib/faker/default/json.rb +19 -2
  52. data/lib/faker/default/lorem.rb +91 -20
  53. data/lib/faker/default/lorem_flickr.rb +38 -5
  54. data/lib/faker/default/lorem_pixel.rb +10 -1
  55. data/lib/faker/default/markdown.rb +12 -7
  56. data/lib/faker/default/marketing.rb +9 -0
  57. data/lib/faker/default/measurement.rb +40 -8
  58. data/lib/faker/default/military.rb +45 -0
  59. data/lib/faker/default/name.rb +6 -4
  60. data/lib/faker/default/nation.rb +48 -5
  61. data/lib/faker/default/nato_phonetic_alphabet.rb +9 -0
  62. data/lib/faker/default/nhs.rb +11 -7
  63. data/lib/faker/default/number.rb +202 -30
  64. data/lib/faker/default/omniauth.rb +98 -15
  65. data/lib/faker/default/phone_number.rb +5 -1
  66. data/lib/faker/default/placeholdit.rb +11 -1
  67. data/lib/faker/default/programming_language.rb +18 -0
  68. data/lib/faker/default/relationship.rb +5 -1
  69. data/lib/faker/default/restaurant.rb +54 -2
  70. data/lib/faker/default/science.rb +27 -0
  71. data/lib/faker/default/source.rb +59 -3
  72. data/lib/faker/default/south_africa.rb +1 -1
  73. data/lib/faker/default/space.rb +2 -2
  74. data/lib/faker/default/string.rb +5 -1
  75. data/lib/faker/default/stripe.rb +20 -4
  76. data/lib/faker/default/subscription.rb +45 -0
  77. data/lib/faker/default/superhero.rb +45 -0
  78. data/lib/faker/default/time.rb +133 -8
  79. data/lib/faker/default/twitter.rb +62 -48
  80. data/lib/faker/default/types.rb +29 -7
  81. data/lib/faker/default/vehicle.rb +19 -6
  82. data/lib/faker/default/world_cup.rb +61 -2
  83. data/lib/faker/games/dota.rb +53 -2
  84. data/lib/faker/games/elder_scrolls.rb +73 -1
  85. data/lib/faker/games/fallout.rb +38 -1
  86. data/lib/faker/games/game.rb +27 -0
  87. data/lib/faker/games/half_life.rb +28 -1
  88. data/lib/faker/games/heroes.rb +28 -1
  89. data/lib/faker/games/heroes_of_the_storm.rb +37 -1
  90. data/lib/faker/games/league_of_legends.rb +55 -1
  91. data/lib/faker/games/myst.rb +46 -1
  92. data/lib/faker/games/overwatch.rb +28 -1
  93. data/lib/faker/games/pokemon.rb +28 -1
  94. data/lib/faker/games/sonic_the_hedgehog.rb +28 -1
  95. data/lib/faker/games/super_smash_bros.rb +19 -1
  96. data/lib/faker/games/witcher.rb +55 -1
  97. data/lib/faker/games/world_of_warcraft.rb +19 -1
  98. data/lib/faker/games/zelda.rb +38 -2
  99. data/lib/faker/japanese_media/dragon_ball.rb +10 -1
  100. data/lib/faker/japanese_media/one_piece.rb +55 -1
  101. data/lib/faker/japanese_media/sword_art_online.rb +37 -1
  102. data/lib/faker/movies/back_to_the_future.rb +29 -1
  103. data/lib/faker/movies/ghostbusters.rb +29 -1
  104. data/lib/faker/movies/harry_potter.rb +55 -1
  105. data/lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb +70 -1
  106. data/lib/faker/movies/hobbit.rb +38 -1
  107. data/lib/faker/movies/lebowski.rb +28 -1
  108. data/lib/faker/movies/lord_of_the_rings.rb +29 -1
  109. data/lib/faker/movies/movie.rb +9 -0
  110. data/lib/faker/movies/princess_bride.rb +20 -1
  111. data/lib/faker/movies/star_wars.rb +101 -5
  112. data/lib/faker/movies/v_for_vendetta.rb +30 -1
  113. data/lib/faker/music/grateful_dead.rb +18 -0
  114. data/lib/faker/music/phish.rb +9 -0
  115. data/lib/faker/music/rock_band.rb +9 -0
  116. data/lib/faker/music/umphreys_mcgee.rb +9 -0
  117. data/lib/faker/sports/basketball.rb +36 -0
  118. data/lib/faker/sports/football.rb +45 -0
  119. data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +10 -1
  120. data/lib/faker/tv_shows/bojack_horseman.rb +29 -1
  121. data/lib/faker/tv_shows/breaking_bad.rb +19 -1
  122. data/lib/faker/tv_shows/buffy.rb +46 -1
  123. data/lib/faker/tv_shows/community.rb +20 -1
  124. data/lib/faker/tv_shows/dr_who.rb +79 -3
  125. data/lib/faker/tv_shows/dumb_and_dumber.rb +29 -1
  126. data/lib/faker/tv_shows/family_guy.rb +29 -1
  127. data/lib/faker/tv_shows/friends.rb +28 -1
  128. data/lib/faker/tv_shows/game_of_thrones.rb +47 -1
  129. data/lib/faker/tv_shows/hey_arnold.rb +28 -1
  130. data/lib/faker/tv_shows/how_i_met_your_mother.rb +38 -1
  131. data/lib/faker/tv_shows/michael_scott.rb +14 -1
  132. data/lib/faker/tv_shows/new_girl.rb +20 -1
  133. data/lib/faker/tv_shows/parks_and_rec.rb +19 -1
  134. data/lib/faker/tv_shows/rick_and_morty.rb +29 -1
  135. data/lib/faker/tv_shows/ru_paul.rb +19 -1
  136. data/lib/faker/tv_shows/seinfeld.rb +29 -1
  137. data/lib/faker/tv_shows/silicon_valley.rb +76 -1
  138. data/lib/faker/tv_shows/simpsons.rb +29 -1
  139. data/lib/faker/tv_shows/south_park.rb +20 -1
  140. data/lib/faker/tv_shows/star_trek.rb +37 -1
  141. data/lib/faker/tv_shows/stargate.rb +29 -1
  142. data/lib/faker/tv_shows/stranger_things.rb +20 -1
  143. data/lib/faker/tv_shows/the_expanse.rb +37 -1
  144. data/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb +29 -1
  145. data/lib/faker/tv_shows/the_it_crowd.rb +38 -1
  146. data/lib/faker/tv_shows/the_thick_of_it.rb +29 -1
  147. data/lib/faker/tv_shows/twin_peaks.rb +29 -1
  148. data/lib/faker/tv_shows/venture_bros.rb +39 -1
  149. data/lib/faker/version.rb +1 -1
  150. data/lib/locales/en-CA.yml +2 -1
  151. data/lib/locales/en-IND.yml +1 -1
  152. data/lib/locales/en-TH.yml +360 -0
  153. data/lib/locales/en.yml +4 -1
  154. data/lib/locales/en/address.yml +1 -4
  155. data/lib/locales/en/animal.yml +2 -2
  156. data/lib/locales/en/cannabis.yml +1 -0
  157. data/lib/locales/en/color.yml +1 -1
  158. data/lib/locales/en/dr_who.yml +1 -1
  159. data/lib/locales/en/science.yml +1 -1
  160. data/lib/locales/en/space.yml +1 -1
  161. data/lib/locales/en/super_smash_bros.yml +5 -0
  162. data/lib/locales/fr-CA.yml +1 -1
  163. data/lib/locales/ja.yml +12 -9
  164. data/lib/locales/th.yml +380 -0
  165. data/lib/locales/vi.yml +1 -1
  166. metadata +44 -27
  167. data/lib/faker/default/creature.rb +0 -6
  168. data/lib/faker/default/games.rb +0 -6
  169. data/lib/faker/default/japanese_media.rb +0 -6
  170. data/lib/faker/default/movies.rb +0 -6
  171. data/lib/faker/default/tv_shows.rb +0 -6
  172. data/lib/faker/deprecate/unreleased/football.rb +0 -35
  173. data/lib/faker/deprecate/unreleased/movies/grateful_dead.rb +0 -22
@@ -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,8 +8,13 @@ module Faker
8
8
  sample(translate('faker.lorem.words'))
9
9
  end
10
10
 
11
- def words(num = 3, supplemental = false)
12
- resolved_num = resolve(num)
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
+
17
+ resolved_num = resolve(number)
13
18
  word_list = (
14
19
  translate('faker.lorem.words') +
15
20
  (supplemental ? translate('faker.lorem.supplemental') : [])
@@ -22,44 +27,110 @@ module Faker
22
27
  sample(Types::CHARACTERS)
23
28
  end
24
29
 
25
- def characters(char_count = 255)
26
- Alphanumeric.alphanumeric(char_count)
30
+ ##
31
+ # Produces a random string of alphanumeric characters
32
+ #
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
36
+ #
37
+ # @return [String]
38
+ #
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"
44
+ #
45
+ # @faker.version 2.1.3
46
+ def characters(legacy_number = NOT_GIVEN, number: 255, min_alpha: 0, min_numeric: 0)
47
+ warn_for_deprecated_arguments do |keywords|
48
+ keywords << :number if legacy_number != NOT_GIVEN
49
+ end
50
+
51
+ Alphanumeric.alphanumeric(number: number, min_alpha: min_alpha, min_numeric: min_numeric)
27
52
  end
28
53
 
29
54
  def multibyte
30
55
  sample(translate('faker.lorem.multibyte')).pack('C*').force_encoding('utf-8')
31
56
  end
32
57
 
33
- def sentence(word_count = 4, supplemental = false, random_words_to_add = 0)
34
- words(word_count + rand(random_words_to_add.to_i), supplemental).join(' ').capitalize + locale_period
58
+ # rubocop:disable Metrics/ParameterLists
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)
60
+ # rubocop:enable Metrics/ParameterLists
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
65
+ end
66
+
67
+ words(number: word_count + rand(random_words_to_add.to_i), supplemental: supplemental).join(' ').capitalize + locale_period
35
68
  end
36
69
 
37
- def sentences(sentence_count = 3, supplemental = false)
38
- 1.upto(resolve(sentence_count)).collect { sentence(3, supplemental) }
70
+ def sentences(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
71
+ warn_for_deprecated_arguments do |keywords|
72
+ keywords << :number if legacy_number != NOT_GIVEN
73
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
74
+ end
75
+
76
+ 1.upto(resolve(number)).collect { sentence(word_count: 3, supplemental: supplemental) }
39
77
  end
40
78
 
41
- def paragraph(sentence_count = 3, supplemental = false, random_sentences_to_add = 0)
42
- sentences(resolve(sentence_count) + rand(random_sentences_to_add.to_i), supplemental).join(locale_space)
79
+ # rubocop:disable Metrics/ParameterLists
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)
81
+ # rubocop:enable Metrics/ParameterLists
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
86
+ end
87
+
88
+ sentences(number: resolve(sentence_count) + rand(random_sentences_to_add.to_i), supplemental: supplemental).join(locale_space)
43
89
  end
44
90
 
45
- def paragraphs(paragraph_count = 3, supplemental = false)
46
- 1.upto(resolve(paragraph_count)).collect { paragraph(3, supplemental) }
91
+ def paragraphs(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
92
+ warn_for_deprecated_arguments do |keywords|
93
+ keywords << :number if legacy_number != NOT_GIVEN
94
+ end
95
+ warn_for_deprecated_arguments do |keywords|
96
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
97
+ end
98
+
99
+ 1.upto(resolve(number)).collect { paragraph(sentence_count: 3, supplemental: supplemental) }
47
100
  end
48
101
 
49
- def paragraph_by_chars(chars = 256, supplemental = false)
50
- paragraph = paragraph(3, supplemental)
102
+ def paragraph_by_chars(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 256, supplemental: false)
103
+ warn_for_deprecated_arguments do |keywords|
104
+ keywords << :number if legacy_number != NOT_GIVEN
105
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
106
+ end
107
+
108
+ paragraph = paragraph(sentence_count: 3, supplemental: supplemental)
51
109
 
52
- paragraph += ' ' + paragraph(3, supplemental) while paragraph.length < chars
110
+ paragraph += ' ' + paragraph(sentence_count: 3, supplemental: supplemental) while paragraph.length < number
53
111
 
54
- paragraph[0...chars - 1] + '.'
112
+ paragraph[0...number - 1] + '.'
55
113
  end
56
114
 
57
- def question(word_count = 4, supplemental = false, random_words_to_add = 0)
58
- words(word_count + rand(random_words_to_add), supplemental).join(' ').capitalize + locale_question_mark
115
+ # rubocop:disable Metrics/ParameterLists
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)
117
+ # rubocop:enable Metrics/ParameterLists
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
122
+ end
123
+
124
+ words(number: word_count + rand(random_words_to_add), supplemental: supplemental).join(' ').capitalize + locale_question_mark
59
125
  end
60
126
 
61
- def questions(question_count = 3, supplemental = false)
62
- 1.upto(resolve(question_count)).collect { question(3, supplemental) }
127
+ def questions(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
128
+ warn_for_deprecated_arguments do |keywords|
129
+ keywords << :number if legacy_number != NOT_GIVEN
130
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
131
+ end
132
+
133
+ 1.upto(resolve(number)).collect { question(word_count: 3, supplemental: supplemental) }
63
134
  end
64
135
 
65
136
  private
@@ -5,23 +5,56 @@ module Faker
5
5
  class << self
6
6
  SUPPORTED_COLORIZATIONS = %w[red green blue].freeze
7
7
 
8
- def image(size = '300x300', search_terms = [], match_all = false)
8
+ # rubocop:disable Metrics/ParameterLists
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
+ # rubocop:enable Metrics/ParameterLists
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
15
+ end
16
+
9
17
  build_url(size, nil, search_terms, match_all)
10
18
  end
11
19
 
12
- def grayscale_image(size = '300x300', search_terms = ['all'], match_all = false)
20
+ # rubocop:disable Metrics/ParameterLists
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)
22
+ # rubocop:enable Metrics/ParameterLists
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
27
+ end
28
+
13
29
  raise ArgumentError, 'Search terms must be specified for grayscale images' unless search_terms.any?
14
30
 
15
31
  build_url(size, 'g', search_terms, match_all)
16
32
  end
17
33
 
18
- def pixelated_image(size = '300x300', search_terms = ['all'], match_all = false)
34
+ # rubocop:disable Metrics/ParameterLists
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)
36
+ # rubocop:enable Metrics/ParameterLists
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
41
+ end
42
+
19
43
  raise ArgumentError, 'Search terms must be specified for pixelated images' unless search_terms.any?
20
44
 
21
45
  build_url(size, 'p', search_terms, match_all)
22
46
  end
23
47
 
24
- def colorized_image(size = '300x300', color = 'red', search_terms = ['all'], match_all = false)
48
+ # rubocop:disable Metrics/ParameterLists
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)
50
+ # rubocop:enable Metrics/ParameterLists
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
56
+ end
57
+
25
58
  raise ArgumentError, 'Search terms must be specified for colorized images' unless search_terms.any?
26
59
  raise ArgumentError, "Supported colorizations are #{SUPPORTED_COLORIZATIONS.join(', ')}" unless SUPPORTED_COLORIZATIONS.include?(color)
27
60
 
@@ -33,7 +66,7 @@ module Faker
33
66
  def build_url(size, format, search_terms, match_all)
34
67
  raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
35
68
 
36
- url_parts = ['http://loremflickr.com']
69
+ url_parts = ['https://loremflickr.com']
37
70
  url_parts << format
38
71
  url_parts += size.split('x')
39
72
  url_parts << search_terms.compact.join(',') if search_terms.any?
@@ -18,7 +18,16 @@ module Faker
18
18
  transport].freeze
19
19
 
20
20
  # rubocop:disable Metrics/ParameterLists
21
- def image(size = '300x300', is_gray = false, category = nil, number = nil, text = nil, secure: true)
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
+ 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
29
+ end
30
+
22
31
  raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
23
32
  raise ArgumentError, "Supported categories are #{SUPPORTED_CATEGORIES.join(', ')}" unless category.nil? || SUPPORTED_CATEGORIES.include?(category)
24
33
  raise ArgumentError, 'Category required when number is passed' if !number.nil? && category.nil?
@@ -8,7 +8,7 @@ module Faker
8
8
  end
9
9
 
10
10
  def emphasis
11
- paragraph = Faker::Lorem.paragraph(3)
11
+ paragraph = Faker::Lorem.paragraph(sentence_count: 3)
12
12
  words = paragraph.split(' ')
13
13
  position = rand(0..words.length - 1)
14
14
  formatting = fetch('markdown.emphasis')
@@ -21,7 +21,7 @@ module Faker
21
21
 
22
22
  result = []
23
23
  number.times do |i|
24
- result << "#{i}. #{Faker::Lorem.sentence(1)} \n"
24
+ result << "#{i}. #{Faker::Lorem.sentence(word_count: 1)} \n"
25
25
  end
26
26
  result.join('')
27
27
  end
@@ -31,17 +31,17 @@ module Faker
31
31
 
32
32
  result = []
33
33
  number.times do |_i|
34
- result << "* #{Faker::Lorem.sentence(1)} \n"
34
+ result << "* #{Faker::Lorem.sentence(word_count: 1)} \n"
35
35
  end
36
36
  result.join('')
37
37
  end
38
38
 
39
39
  def inline_code
40
- "`#{Faker::Lorem.sentence(1)}`"
40
+ "`#{Faker::Lorem.sentence(word_count: 1)}`"
41
41
  end
42
42
 
43
43
  def block_code
44
- "```ruby\n#{Lorem.sentence(1)}\n```"
44
+ "```ruby\n#{Lorem.sentence(word_count: 1)}\n```"
45
45
  end
46
46
 
47
47
  def table
@@ -59,11 +59,16 @@ module Faker
59
59
  send(method_list[rand(0..method_list.length - 1)])
60
60
  end
61
61
 
62
- def sandwich(sentences = 3, repeat = 1)
62
+ def sandwich(legacy_sentences = NOT_GIVEN, legacy_repeat = NOT_GIVEN, sentences: 3, repeat: 1)
63
+ warn_for_deprecated_arguments do |keywords|
64
+ keywords << :sentences if legacy_sentences != NOT_GIVEN
65
+ keywords << :repeat if legacy_repeat != NOT_GIVEN
66
+ end
67
+
63
68
  text_block = []
64
69
  text_block << headers
65
70
  repeat.times do
66
- text_block << Faker::Lorem.paragraph(sentences)
71
+ text_block << Faker::Lorem.paragraph(sentence_count: sentences)
67
72
  text_block << random
68
73
  end
69
74
  text_block.join("\n")
@@ -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
@@ -6,35 +6,67 @@ module Faker
6
6
  ALL = 'all'
7
7
  NONE = 'none'
8
8
 
9
- def height(amount = rand(10))
9
+ def height(legacy_amount = NOT_GIVEN, amount: rand(10))
10
+ warn_for_deprecated_arguments do |keywords|
11
+ keywords << :amount if legacy_amount != NOT_GIVEN
12
+ end
13
+
10
14
  define_measurement_locale(amount, 'height')
11
15
  end
12
16
 
13
- def length(amount = rand(10))
17
+ def length(legacy_amount = NOT_GIVEN, amount: rand(10))
18
+ warn_for_deprecated_arguments do |keywords|
19
+ keywords << :amount if legacy_amount != NOT_GIVEN
20
+ end
21
+
14
22
  define_measurement_locale(amount, 'length')
15
23
  end
16
24
 
17
- def volume(amount = rand(10))
25
+ def volume(legacy_amount = NOT_GIVEN, amount: rand(10))
26
+ warn_for_deprecated_arguments do |keywords|
27
+ keywords << :amount if legacy_amount != NOT_GIVEN
28
+ end
29
+
18
30
  define_measurement_locale(amount, 'volume')
19
31
  end
20
32
 
21
- def weight(amount = rand(10))
33
+ def weight(legacy_amount = NOT_GIVEN, amount: rand(10))
34
+ warn_for_deprecated_arguments do |keywords|
35
+ keywords << :amount if legacy_amount != NOT_GIVEN
36
+ end
37
+
22
38
  define_measurement_locale(amount, 'weight')
23
39
  end
24
40
 
25
- def metric_height(amount = rand(10))
41
+ def metric_height(legacy_amount = NOT_GIVEN, amount: rand(10))
42
+ warn_for_deprecated_arguments do |keywords|
43
+ keywords << :amount if legacy_amount != NOT_GIVEN
44
+ end
45
+
26
46
  define_measurement_locale(amount, 'metric_height')
27
47
  end
28
48
 
29
- def metric_length(amount = rand(10))
49
+ def metric_length(legacy_amount = NOT_GIVEN, amount: rand(10))
50
+ warn_for_deprecated_arguments do |keywords|
51
+ keywords << :amount if legacy_amount != NOT_GIVEN
52
+ end
53
+
30
54
  define_measurement_locale(amount, 'metric_length')
31
55
  end
32
56
 
33
- def metric_volume(amount = rand(10))
57
+ def metric_volume(legacy_amount = NOT_GIVEN, amount: rand(10))
58
+ warn_for_deprecated_arguments do |keywords|
59
+ keywords << :amount if legacy_amount != NOT_GIVEN
60
+ end
61
+
34
62
  define_measurement_locale(amount, 'metric_volume')
35
63
  end
36
64
 
37
- def metric_weight(amount = rand(10))
65
+ def metric_weight(legacy_amount = NOT_GIVEN, amount: rand(10))
66
+ warn_for_deprecated_arguments do |keywords|
67
+ keywords << :amount if legacy_amount != NOT_GIVEN
68
+ end
69
+
38
70
  define_measurement_locale(amount, 'metric_weight')
39
71
  end
40
72
 
@@ -3,22 +3,67 @@
3
3
  module Faker
4
4
  class Military < Base
5
5
  class << self
6
+ ##
7
+ # Produces a rank in the U.S. Army.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::Military.army_rank #=> "Staff Sergeant"
13
+ #
14
+ # @faker.version 1.9.0
6
15
  def army_rank
7
16
  fetch('military.army_rank')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces a rank in the U.S. Marines.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::Military.marines_rank #=> "Gunnery Sergeant"
26
+ #
27
+ # @faker.version 1.9.0
10
28
  def marines_rank
11
29
  fetch('military.marines_rank')
12
30
  end
13
31
 
32
+ ##
33
+ # Produces a rank in the U.S. Navy.
34
+ #
35
+ # @return [String]
36
+ #
37
+ # @example
38
+ # Faker::Military.navy_rank #=> "Seaman"
39
+ #
40
+ # @faker.version 1.9.0
14
41
  def navy_rank
15
42
  fetch('military.navy_rank')
16
43
  end
17
44
 
45
+ ##
46
+ # Produces a rank in the U.S. Air Force.
47
+ #
48
+ # @return [String]
49
+ #
50
+ # @example
51
+ # Faker::Military.air_force_rank #=> "Captain"
52
+ #
53
+ # @faker.version 1.9.0
18
54
  def air_force_rank
19
55
  fetch('military.air_force_rank')
20
56
  end
21
57
 
58
+ ##
59
+ # Produces a U.S. Department of Defense Paygrade.
60
+ #
61
+ # @return [String]
62
+ #
63
+ # @example
64
+ # Faker::Military.dod_paygrade #=> "E-6"
65
+ #
66
+ # @faker.version 1.9.0
22
67
  def dod_paygrade
23
68
  fetch('military.dod_paygrade')
24
69
  end