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
@@ -6,10 +6,16 @@ module Faker
6
6
  NI_CHANCE = 0.03 # NI Pop is about 3% of total UK population
7
7
 
8
8
  class << self
9
- def british_driving_licence(last_name: Faker::Name.last_name,
10
- initials: Faker::Name.initials,
11
- gender: random_gender,
12
- date_of_birth: Faker::Date.birthday(18, 65))
9
+ # rubocop:disable Metrics/ParameterLists
10
+ def british_driving_licence(legacy_last_name = NOT_GIVEN, legacy_initials = NOT_GIVEN, legacy_gender = NOT_GIVEN, legacy_date_of_birth = NOT_GIVEN, last_name: Faker::Name.last_name, initials: Faker::Name.initials, gender: random_gender, date_of_birth: Faker::Date.birthday(min_age: 18, max_age: 65))
11
+ # rubocop:enable Metrics/ParameterLists
12
+ warn_for_deprecated_arguments do |keywords|
13
+ keywords << :last_name if legacy_last_name != NOT_GIVEN
14
+ keywords << :initials if legacy_initials != NOT_GIVEN
15
+ keywords << :gender if legacy_gender != NOT_GIVEN
16
+ keywords << :date_of_birth if legacy_date_of_birth != NOT_GIVEN
17
+ end
18
+
13
19
  [
14
20
  gb_licence_padding(last_name, 5),
15
21
  gb_licence_year(date_of_birth, gender),
@@ -19,7 +25,7 @@ module Faker
19
25
  end
20
26
 
21
27
  def northern_irish_driving_licence
22
- Faker::Number.number(8)
28
+ Faker::Number.number(digits: 8).to_s
23
29
  end
24
30
 
25
31
  def uk_driving_licence(*args)
@@ -46,9 +52,9 @@ module Faker
46
52
  year = dob.year % 10
47
53
  month = gender == :female ? dob.month + 50 : dob.month
48
54
  # Rubocop's preferred formatting is pretty gory
49
- # rubocop:disable FormatString
55
+ # rubocop:disable Style/FormatString
50
56
  "#{decade}#{'%02d' % month}#{'%02d' % dob.day}#{year}"
51
- # rubocop:enable FormatString
57
+ # rubocop:enable Style/FormatString
52
58
  end
53
59
 
54
60
  def gb_licence_checksum
@@ -5,8 +5,6 @@ module Faker
5
5
  flexible :educator
6
6
 
7
7
  class << self
8
- extend Gem::Deprecate
9
-
10
8
  def university
11
9
  "#{parse('educator.name')} #{fetch('educator.tertiary.type')}"
12
10
  end
@@ -16,7 +14,6 @@ module Faker
16
14
  end
17
15
 
18
16
  alias course degree
19
- deprecate :course, :course_name, 2018, 10
20
17
 
21
18
  def subject
22
19
  fetch('educator.tertiary.degree.subject')
@@ -5,14 +5,41 @@ module Faker
5
5
  flexible :electrical_components
6
6
 
7
7
  class << self
8
+ ##
9
+ # Produces an active electrical component.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::ElectricalComponents.active #=> "Transistor"
15
+ #
16
+ # @faker.version 1.9.0
8
17
  def active
9
18
  fetch('electrical_components.active')
10
19
  end
11
20
 
21
+ ##
22
+ # Produces a passive electrical component.
23
+ #
24
+ # @return [String]
25
+ #
26
+ # @example
27
+ # Faker::ElectricalComponents.passive #=> "Resistor"
28
+ #
29
+ # @faker.version 1.9.0
12
30
  def passive
13
31
  fetch('electrical_components.passive')
14
32
  end
15
33
 
34
+ ##
35
+ # Produces an electromechanical electrical component.
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example
40
+ # Faker::ElectricalComponents.electromechanical #=> "Toggle Switch"
41
+ #
42
+ # @faker.version 1.9.0
16
43
  def electromechanical
17
44
  fetch('electrical_components.electromechanical')
18
45
  end
@@ -3,7 +3,15 @@
3
3
  module Faker
4
4
  class File < Base
5
5
  class << self
6
- def dir(segment_count = 3, root = nil, directory_separator = '/')
6
+ # rubocop:disable Metrics/ParameterLists
7
+ def dir(legacy_segment_count = NOT_GIVEN, legacy_root = NOT_GIVEN, legacy_directory_separator = NOT_GIVEN, segment_count: 3, root: nil, directory_separator: '/')
8
+ # rubocop:enable Metrics/ParameterLists
9
+ warn_for_deprecated_arguments do |keywords|
10
+ keywords << :segment_count if legacy_segment_count != NOT_GIVEN
11
+ keywords << :root if legacy_root != NOT_GIVEN
12
+ keywords << :directory_separator if legacy_directory_separator != NOT_GIVEN
13
+ end
14
+
7
15
  Array
8
16
  .new(segment_count) { Faker::Internet.slug }
9
17
  .unshift(root)
@@ -20,8 +28,17 @@ module Faker
20
28
  fetch('file.mime_type')
21
29
  end
22
30
 
23
- def file_name(dir = nil, name = nil, ext = nil, directory_separator = '/')
24
- dir ||= dir(1)
31
+ # rubocop:disable Metrics/ParameterLists
32
+ def file_name(legacy_dir = NOT_GIVEN, legacy_name = NOT_GIVEN, legacy_ext = NOT_GIVEN, legacy_directory_separator = NOT_GIVEN, dir: nil, name: nil, ext: nil, directory_separator: '/')
33
+ # rubocop:enable Metrics/ParameterLists
34
+ warn_for_deprecated_arguments do |keywords|
35
+ keywords << :dir if legacy_dir != NOT_GIVEN
36
+ keywords << :name if legacy_name != NOT_GIVEN
37
+ keywords << :ext if legacy_ext != NOT_GIVEN
38
+ keywords << :directory_separator if legacy_directory_separator != NOT_GIVEN
39
+ end
40
+
41
+ dir ||= dir(segment_count: 1)
25
42
  name ||= Faker::Lorem.word.downcase
26
43
  ext ||= extension
27
44
 
@@ -3,12 +3,20 @@
3
3
  module Faker
4
4
  class Fillmurray < Base
5
5
  class << self
6
- def image(grayscale = false, width = 200, height = 200)
6
+ # rubocop:disable Metrics/ParameterLists
7
+ def image(legacy_grayscale = NOT_GIVEN, legacy_width = NOT_GIVEN, legacy_height = NOT_GIVEN, grayscale: false, width: 200, height: 200)
8
+ # rubocop:enable Metrics/ParameterLists
9
+ warn_for_deprecated_arguments do |keywords|
10
+ keywords << :grayscale if legacy_grayscale != NOT_GIVEN
11
+ keywords << :width if legacy_width != NOT_GIVEN
12
+ keywords << :height if legacy_height != NOT_GIVEN
13
+ end
14
+
7
15
  raise ArgumentError, 'Width should be a number' unless width.to_s =~ /^\d+$/
8
16
  raise ArgumentError, 'Height should be a number' unless height.to_s =~ /^\d+$/
9
17
  raise ArgumentError, 'Grayscale should be a boolean' unless [true, false].include?(grayscale)
10
18
 
11
- grayscale == true ? "https://fillmurray.com/g/#{width}/#{height}" : "https://fillmurray.com/#{width}/#{height}"
19
+ "https://www.fillmurray.com#{'/g' if grayscale == true}/#{width}/#{height}"
12
20
  end
13
21
  end
14
22
  end
@@ -26,7 +26,11 @@ module Faker
26
26
  template.gsub('L', luhn_digit.to_s)
27
27
  end
28
28
 
29
- def vat_number(country = 'BR')
29
+ def vat_number(legacy_country = NOT_GIVEN, country: 'BR')
30
+ warn_for_deprecated_arguments do |keywords|
31
+ keywords << :country if legacy_country != NOT_GIVEN
32
+ end
33
+
30
34
  numerify(fetch("finance.vat_number.#{country}"))
31
35
  rescue I18n::MissingTranslationData
32
36
  raise ArgumentError, "Could not find vat number for #{country}"
@@ -3,10 +3,28 @@
3
3
  module Faker
4
4
  class Gender < Base
5
5
  class << self
6
+ ##
7
+ # Produces the name of a gender identity.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::Gender.type #=> "Non-binary"
13
+ #
14
+ # @faker.version 1.9.0
6
15
  def type
7
16
  fetch('gender.types')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces either 'Male' or 'Female'.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::Gender.binary_type #=> "Female"
26
+ #
27
+ # @faker.version 1.9.0
10
28
  def binary_type
11
29
  fetch('gender.binary_types')
12
30
  end
@@ -3,10 +3,28 @@
3
3
  module Faker
4
4
  class GreekPhilosophers < Base
5
5
  class << self
6
+ ##
7
+ # Produces the name of a Greek philosopher.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::GreekPhilosophers.name #=> "Socrates"
13
+ #
14
+ # @faker.version 1.9.0
6
15
  def name
7
16
  fetch('greek_philosophers.names')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces a quote from a Greek philosopher.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::GreekPhilosophers.quote #=> "Only the educated are free."
26
+ #
27
+ # @faker.version 1.9.0
10
28
  def quote
11
29
  fetch('greek_philosophers.quotes')
12
30
  end
@@ -1,35 +1,93 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Port of http://shinytoylabs.com/jargon/
4
3
  module Faker
4
+ # Port of http://shinytoylabs.com/jargon/
5
+ # Are you having trouble writing tech-savvy dialogue for your latest screenplay?
6
+ # Worry not! Hollywood-grade technical talk is ready to fill out any form where you need to look smart.
5
7
  class Hacker < Base
6
8
  flexible :hacker
7
9
 
8
10
  class << self
11
+ ##
12
+ # Produces something smart.
13
+ #
14
+ # @return [String]
15
+ #
16
+ # @example
17
+ # Faker::Hacker.say_something_smart
18
+ # #=> "Try to compress the SQL interface, maybe it will program the back-end hard drive!"
19
+ #
20
+ # @faker.version 1.4.0
9
21
  def say_something_smart
10
22
  sample(phrases)
11
23
  end
12
24
 
25
+ ##
26
+ # Short technical abbreviations.
27
+ #
28
+ # @return [String]
29
+ #
30
+ # @example
31
+ # Faker::Hacker.abbreviation #=> "RAM"
32
+ #
33
+ # @faker.version 1.4.0
13
34
  def abbreviation
14
35
  fetch('hacker.abbreviation')
15
36
  end
16
37
 
38
+ ##
39
+ # Hacker-centric adjectives.
40
+ #
41
+ # @return [String]
42
+ #
43
+ # @example
44
+ # Faker::Hacker.adjective #=> "open-source"
45
+ #
46
+ # @faker.version 1.4.0
17
47
  def adjective
18
48
  fetch('hacker.adjective')
19
49
  end
20
50
 
51
+ ##
52
+ # Only the best hacker-related nouns.
53
+ #
54
+ # @return [String]
55
+ #
56
+ # @example
57
+ # Faker::Hacker.noun #=> "bandwidth"
58
+ #
59
+ # @faker.version 1.4.0
21
60
  def noun
22
61
  fetch('hacker.noun')
23
62
  end
24
63
 
64
+ ##
65
+ # Actions that hackers take.
66
+ #
67
+ # @return [String]
68
+ #
69
+ # @example
70
+ # Faker::Hacker.verb #=> "bypass"
71
+ #
72
+ # @faker.version 1.4.0
25
73
  def verb
26
74
  fetch('hacker.verb')
27
75
  end
28
76
 
77
+ ##
78
+ # Produces a verb that ends with '-ing'.
79
+ #
80
+ # @return [String]
81
+ #
82
+ # @example
83
+ # Faker::Hacker.ingverb #=> "synthesizing"
84
+ #
85
+ # @faker.version 1.4.0
29
86
  def ingverb
30
87
  fetch('hacker.ingverb')
31
88
  end
32
89
 
90
+ # @private
33
91
  def phrases
34
92
  ["If we #{verb} the #{noun}, we can get to the #{abbreviation} #{noun} through the #{adjective} #{abbreviation} #{noun}!",
35
93
  "We need to #{verb} the #{adjective} #{abbreviation} #{noun}!",
@@ -8,8 +8,16 @@ module Faker
8
8
  random_word =~ /\s/ ? word : random_word
9
9
  end
10
10
 
11
- def words(num = 3, supplemental = false, spaces_allowed = false)
12
- resolved_num = resolve(num)
11
+ # rubocop:disable Metrics/ParameterLists
12
+ def words(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, legacy_spaces_allowed = NOT_GIVEN, number: 3, supplemental: false, spaces_allowed: false)
13
+ # rubocop:enable Metrics/ParameterLists
14
+ warn_for_deprecated_arguments do |keywords|
15
+ keywords << :number if legacy_number != NOT_GIVEN
16
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
17
+ keywords << :spaces_allowed if legacy_spaces_allowed != NOT_GIVEN
18
+ end
19
+
20
+ resolved_num = resolve(number)
13
21
  word_list = (
14
22
  translate('faker.hipster.words') +
15
23
  (supplemental ? translate('faker.lorem.words') : [])
@@ -22,36 +30,67 @@ module Faker
22
30
  words.each_with_index { |w, i| words[i] = word if w =~ /\s/ }
23
31
  end
24
32
 
25
- def sentence(word_count = 4, supplemental = false, random_words_to_add = 6)
26
- words(word_count + rand(random_words_to_add.to_i).to_i, supplemental, true).join(' ').capitalize + '.'
33
+ # rubocop:disable Metrics/ParameterLists
34
+ 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: 6)
35
+ # rubocop:enable Metrics/ParameterLists
36
+ warn_for_deprecated_arguments do |keywords|
37
+ keywords << :word_count if legacy_word_count != NOT_GIVEN
38
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
39
+ keywords << :random_words_to_add if legacy_random_words_to_add != NOT_GIVEN
40
+ end
41
+
42
+ words(number: word_count + rand(random_words_to_add.to_i).to_i, supplemental: supplemental, spaces_allowed: true).join(' ').capitalize + '.'
27
43
  end
28
44
 
29
- def sentences(sentence_count = 3, supplemental = false)
45
+ def sentences(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
46
+ warn_for_deprecated_arguments do |keywords|
47
+ keywords << :number if legacy_number != NOT_GIVEN
48
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
49
+ end
50
+
30
51
  [].tap do |sentences|
31
- 1.upto(resolve(sentence_count)) do
32
- sentences << sentence(3, supplemental)
52
+ 1.upto(resolve(number)) do
53
+ sentences << sentence(word_count: 3, supplemental: supplemental)
33
54
  end
34
55
  end
35
56
  end
36
57
 
37
- def paragraph(sentence_count = 3, supplemental = false, random_sentences_to_add = 3)
38
- sentences(resolve(sentence_count) + rand(random_sentences_to_add.to_i).to_i, supplemental).join(' ')
58
+ # rubocop:disable Metrics/ParameterLists
59
+ 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: 3)
60
+ # rubocop:enable Metrics/ParameterLists
61
+ warn_for_deprecated_arguments do |keywords|
62
+ keywords << :sentence_count if legacy_sentence_count != NOT_GIVEN
63
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
64
+ keywords << :random_sentences_to_add if legacy_random_sentences_to_add != NOT_GIVEN
65
+ end
66
+
67
+ sentences(number: resolve(sentence_count) + rand(random_sentences_to_add.to_i).to_i, supplemental: supplemental).join(' ')
39
68
  end
40
69
 
41
- def paragraphs(paragraph_count = 3, supplemental = false)
70
+ def paragraphs(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
+
42
76
  [].tap do |paragraphs|
43
- 1.upto(resolve(paragraph_count)) do
44
- paragraphs << paragraph(3, supplemental)
77
+ 1.upto(resolve(number)) do
78
+ paragraphs << paragraph(sentence_count: 3, supplemental: supplemental)
45
79
  end
46
80
  end
47
81
  end
48
82
 
49
- def paragraph_by_chars(chars = 256, supplemental = false)
50
- paragraph = paragraph(3, supplemental)
83
+ def paragraph_by_chars(legacy_characters = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, characters: 256, supplemental: false)
84
+ warn_for_deprecated_arguments do |keywords|
85
+ keywords << :characters if legacy_characters != NOT_GIVEN
86
+ keywords << :supplemental if legacy_supplemental != NOT_GIVEN
87
+ end
88
+
89
+ paragraph = paragraph(sentence_count: 3, supplemental: supplemental)
51
90
 
52
- paragraph += ' ' + paragraph(3, supplemental) while paragraph.length < chars
91
+ paragraph += ' ' + paragraph(sentence_count: 3, supplemental: supplemental) while paragraph.length < characters
53
92
 
54
- paragraph[0...chars - 1] + '.'
93
+ paragraph[0...characters - 1] + '.'
55
94
  end
56
95
  end
57
96
  end
@@ -3,10 +3,28 @@
3
3
  module Faker
4
4
  class House < Base
5
5
  class << self
6
+ ##
7
+ # Produces the name of a piece of furniture.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::House.furniture #=> "chair"
13
+ #
14
+ # @faker.version 1.9.2
6
15
  def furniture
7
16
  fetch('house.furniture')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces the name of a room in a house.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::House.room #=> "kitchen"
26
+ #
27
+ # @faker.version 1.9.2
10
28
  def room
11
29
  fetch('house.rooms')
12
30
  end