faker 2.2.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +131 -15
  3. data/README.md +2 -2
  4. data/lib/faker.rb +34 -0
  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 +60 -9
  12. data/lib/faker/books/lovecraft.rb +189 -33
  13. data/lib/faker/creature/animal.rb +9 -0
  14. data/lib/faker/creature/cat.rb +27 -0
  15. data/lib/faker/creature/dog.rb +72 -0
  16. data/lib/faker/creature/horse.rb +18 -0
  17. data/lib/faker/default/address.rb +10 -15
  18. data/lib/faker/default/alphanumeric.rb +29 -18
  19. data/lib/faker/default/app.rb +50 -11
  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 +38 -19
  23. data/lib/faker/default/bank.rb +4 -6
  24. data/lib/faker/default/boolean.rb +14 -4
  25. data/lib/faker/default/chile_rut.rb +6 -14
  26. data/lib/faker/default/chuck_norris.rb +1 -1
  27. data/lib/faker/default/code.rb +7 -13
  28. data/lib/faker/default/commerce.rb +8 -17
  29. data/lib/faker/default/company.rb +4 -6
  30. data/lib/faker/default/crypto_coin.rb +6 -9
  31. data/lib/faker/default/date.rb +76 -30
  32. data/lib/faker/default/demographic.rb +2 -3
  33. data/lib/faker/default/dessert.rb +27 -0
  34. data/lib/faker/default/device.rb +54 -0
  35. data/lib/faker/default/driving_licence.rb +5 -15
  36. data/lib/faker/default/electrical_components.rb +27 -0
  37. data/lib/faker/default/file.rb +9 -26
  38. data/lib/faker/default/fillmurray.rb +4 -11
  39. data/lib/faker/default/finance.rb +2 -3
  40. data/lib/faker/default/gender.rb +18 -0
  41. data/lib/faker/default/greek_philosophers.rb +18 -0
  42. data/lib/faker/default/hacker.rb +59 -1
  43. data/lib/faker/default/hipster.rb +21 -54
  44. data/lib/faker/default/house.rb +18 -0
  45. data/lib/faker/default/id_number.rb +5 -7
  46. data/lib/faker/default/industry_segments.rb +36 -0
  47. data/lib/faker/default/internet.rb +49 -76
  48. data/lib/faker/default/invoice.rb +7 -13
  49. data/lib/faker/default/json.rb +9 -16
  50. data/lib/faker/default/lorem.rb +38 -77
  51. data/lib/faker/default/lorem_flickr.rb +17 -48
  52. data/lib/faker/default/lorem_pixel.rb +7 -23
  53. data/lib/faker/default/markdown.rb +3 -7
  54. data/lib/faker/default/marketing.rb +9 -0
  55. data/lib/faker/default/measurement.rb +16 -24
  56. data/lib/faker/default/military.rb +45 -0
  57. data/lib/faker/default/name.rb +2 -3
  58. data/lib/faker/default/nation.rb +48 -5
  59. data/lib/faker/default/nato_phonetic_alphabet.rb +9 -0
  60. data/lib/faker/default/nhs.rb +2 -3
  61. data/lib/faker/default/number.rb +150 -51
  62. data/lib/faker/default/omniauth.rb +67 -63
  63. data/lib/faker/default/phone_number.rb +2 -3
  64. data/lib/faker/default/placeholdit.rb +6 -19
  65. data/lib/faker/default/programming_language.rb +18 -0
  66. data/lib/faker/default/relationship.rb +2 -3
  67. data/lib/faker/default/restaurant.rb +54 -2
  68. data/lib/faker/default/science.rb +27 -0
  69. data/lib/faker/default/source.rb +51 -14
  70. data/lib/faker/default/string.rb +2 -3
  71. data/lib/faker/default/stripe.rb +8 -12
  72. data/lib/faker/default/subscription.rb +45 -0
  73. data/lib/faker/default/superhero.rb +45 -0
  74. data/lib/faker/default/time.rb +102 -56
  75. data/lib/faker/default/twitter.rb +23 -32
  76. data/lib/faker/default/types.rb +12 -23
  77. data/lib/faker/default/vehicle.rb +8 -14
  78. data/lib/faker/default/world_cup.rb +5 -10
  79. data/lib/faker/games/dota.rb +49 -3
  80. data/lib/faker/games/elder_scrolls.rb +72 -0
  81. data/lib/faker/games/fallout.rb +37 -0
  82. data/lib/faker/games/game.rb +27 -0
  83. data/lib/faker/games/half_life.rb +27 -0
  84. data/lib/faker/games/heroes.rb +27 -0
  85. data/lib/faker/games/heroes_of_the_storm.rb +36 -0
  86. data/lib/faker/games/league_of_legends.rb +54 -0
  87. data/lib/faker/games/myst.rb +45 -0
  88. data/lib/faker/games/overwatch.rb +27 -0
  89. data/lib/faker/games/pokemon.rb +27 -0
  90. data/lib/faker/games/sonic_the_hedgehog.rb +27 -0
  91. data/lib/faker/games/super_smash_bros.rb +18 -0
  92. data/lib/faker/games/witcher.rb +54 -0
  93. data/lib/faker/games/world_of_warcraft.rb +18 -0
  94. data/lib/faker/games/zelda.rb +37 -1
  95. data/lib/faker/japanese_media/dragon_ball.rb +9 -0
  96. data/lib/faker/japanese_media/one_piece.rb +54 -0
  97. data/lib/faker/japanese_media/sword_art_online.rb +36 -0
  98. data/lib/faker/movies/back_to_the_future.rb +28 -0
  99. data/lib/faker/movies/ghostbusters.rb +28 -0
  100. data/lib/faker/movies/harry_potter.rb +54 -0
  101. data/lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb +69 -0
  102. data/lib/faker/movies/hobbit.rb +37 -0
  103. data/lib/faker/movies/lebowski.rb +27 -0
  104. data/lib/faker/movies/lord_of_the_rings.rb +28 -0
  105. data/lib/faker/movies/movie.rb +9 -0
  106. data/lib/faker/movies/princess_bride.rb +19 -0
  107. data/lib/faker/movies/star_wars.rb +97 -6
  108. data/lib/faker/movies/v_for_vendetta.rb +29 -0
  109. data/lib/faker/music/grateful_dead.rb +18 -0
  110. data/lib/faker/music/phish.rb +9 -0
  111. data/lib/faker/music/rock_band.rb +9 -0
  112. data/lib/faker/music/umphreys_mcgee.rb +9 -0
  113. data/lib/faker/sports/basketball.rb +36 -0
  114. data/lib/faker/sports/football.rb +45 -0
  115. data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +9 -0
  116. data/lib/faker/tv_shows/bojack_horseman.rb +28 -0
  117. data/lib/faker/tv_shows/breaking_bad.rb +18 -0
  118. data/lib/faker/tv_shows/buffy.rb +45 -0
  119. data/lib/faker/tv_shows/community.rb +19 -0
  120. data/lib/faker/tv_shows/dr_who.rb +78 -2
  121. data/lib/faker/tv_shows/dumb_and_dumber.rb +28 -0
  122. data/lib/faker/tv_shows/family_guy.rb +28 -0
  123. data/lib/faker/tv_shows/friends.rb +27 -0
  124. data/lib/faker/tv_shows/game_of_thrones.rb +46 -0
  125. data/lib/faker/tv_shows/hey_arnold.rb +27 -0
  126. data/lib/faker/tv_shows/how_i_met_your_mother.rb +37 -0
  127. data/lib/faker/tv_shows/michael_scott.rb +13 -0
  128. data/lib/faker/tv_shows/new_girl.rb +19 -0
  129. data/lib/faker/tv_shows/parks_and_rec.rb +18 -0
  130. data/lib/faker/tv_shows/rick_and_morty.rb +28 -0
  131. data/lib/faker/tv_shows/ru_paul.rb +18 -0
  132. data/lib/faker/tv_shows/seinfeld.rb +28 -0
  133. data/lib/faker/tv_shows/silicon_valley.rb +75 -0
  134. data/lib/faker/tv_shows/simpsons.rb +28 -0
  135. data/lib/faker/tv_shows/south_park.rb +19 -0
  136. data/lib/faker/tv_shows/star_trek.rb +36 -0
  137. data/lib/faker/tv_shows/stargate.rb +28 -0
  138. data/lib/faker/tv_shows/stranger_things.rb +19 -0
  139. data/lib/faker/tv_shows/the_expanse.rb +36 -0
  140. data/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb +28 -0
  141. data/lib/faker/tv_shows/the_it_crowd.rb +37 -0
  142. data/lib/faker/tv_shows/the_thick_of_it.rb +28 -0
  143. data/lib/faker/tv_shows/twin_peaks.rb +28 -0
  144. data/lib/faker/tv_shows/venture_bros.rb +38 -0
  145. data/lib/faker/version.rb +1 -1
  146. data/lib/locales/en-CA.yml +1 -1
  147. data/lib/locales/en-TH.yml +360 -0
  148. data/lib/locales/en/color.yml +1 -1
  149. data/lib/locales/en/dr_who.yml +1 -1
  150. data/lib/locales/en/science.yml +1 -1
  151. data/lib/locales/ja.yml +8 -9
  152. data/lib/locales/th.yml +380 -0
  153. metadata +33 -14
@@ -5,18 +5,54 @@ module Faker
5
5
  flexible :book
6
6
 
7
7
  class << self
8
+ ##
9
+ # Produces a random book title
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Book.title #=> "The Odd Sister"
15
+ #
16
+ # @faker.version 1.9.3
8
17
  def title
9
18
  fetch('book.title')
10
19
  end
11
20
 
21
+ ##
22
+ # Produces a random book author
23
+ #
24
+ # @return [String]
25
+ #
26
+ # @example
27
+ # Faker::Book.author #=> "Alysha Olsen"
28
+ #
29
+ # @faker.version 1.9.3
12
30
  def author
13
31
  parse('book.author')
14
32
  end
15
33
 
34
+ ##
35
+ # Produces a random book publisher
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example
40
+ # Faker::Book.publisher #=> "Opus Reader"
41
+ #
42
+ # @faker.version 1.9.3
16
43
  def publisher
17
44
  fetch('book.publisher')
18
45
  end
19
46
 
47
+ ##
48
+ # Produces a random genre
49
+ #
50
+ # @return [String]
51
+ #
52
+ # @example
53
+ # Faker::Book.genre #=> "Mystery"
54
+ #
55
+ # @faker.version 1.9.3
20
56
  def genre
21
57
  fetch('book.genre')
22
58
  end
@@ -4,27 +4,76 @@ module Faker
4
4
  class Books
5
5
  class CultureSeries < Base
6
6
  flexible :culture_series
7
+
7
8
  class << self
9
+ ##
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Books::CultureSeries.book
14
+ # #=> "The Player of Games"
15
+ #
16
+ # @faker.version 1.9.3
8
17
  def book
9
18
  fetch('culture_series.books')
10
19
  end
11
20
 
21
+ ##
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::Books::CultureSeries.culture_ship
26
+ # #=> "Fate Amenable To Change"
27
+ #
28
+ # @faker.version 1.9.3
12
29
  def culture_ship
13
30
  fetch('culture_series.culture_ships')
14
31
  end
15
32
 
33
+ ##
34
+ # @return [String]
35
+ #
36
+ # @example
37
+ # Faker::Books::CultureSeries.culture_ship_class
38
+ # #=> "General Systems Vehicle"
39
+ #
40
+ # @faker.version 1.9.3
16
41
  def culture_ship_class
17
42
  fetch('culture_series.culture_ship_classes')
18
43
  end
19
44
 
45
+ ##
46
+ # @return [String]
47
+ #
48
+ # @example
49
+ # Faker::Books::CultureSeries.culture_ship_class_abv
50
+ # #=> "The Odd Sister"
51
+ #
52
+ # @faker.version 1.9.3
20
53
  def culture_ship_class_abv
21
54
  fetch('culture_series.culture_ship_class_abvs')
22
55
  end
23
56
 
57
+ ##
58
+ # @return [String]
59
+ #
60
+ # @example
61
+ # Faker::Books::CultureSeries.civ
62
+ # #=> "Culture"
63
+ #
64
+ # @faker.version 1.9.3
24
65
  def civ
25
66
  fetch('culture_series.civs')
26
67
  end
27
68
 
69
+ ##
70
+ # @return [String]
71
+ #
72
+ # @example
73
+ # Faker::Books::CultureSeries.planet
74
+ # #=> "Xinth"
75
+ #
76
+ # @faker.version 1.9.3
28
77
  def planet
29
78
  fetch('culture_series.planets')
30
79
  end
@@ -2,27 +2,65 @@
2
2
 
3
3
  module Faker
4
4
  class Books
5
+ ##
6
+ # A Faker module beyond your dreams, test data beyond your imagination.
5
7
  class Dune < Base
6
8
  class << self
7
- # QUOTED_CHARACTERS = fetch("dune.quotes")
8
- # SAYING_SOURCES = %w(translate("faker.dune.sources"))
9
-
9
+ ##
10
+ # Produces the name of a character from Dune
11
+ #
12
+ # @return [String]
13
+ #
14
+ # @example
15
+ # Faker::Books::Dune.character #=> "Leto Atreides"
16
+ #
17
+ # @faker.version 1.9.3
10
18
  def character
11
19
  fetch('dune.characters')
12
20
  end
13
21
 
22
+ ##
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Books::Dune.title #=> "Duke"
27
+ #
28
+ # @faker.version 1.9.3
14
29
  def title
15
30
  fetch('dune.titles')
16
31
  end
17
32
 
33
+ ##
34
+ # Produces the name of a planet from Dune
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Books::Dune.planet #=> "Caladan"
40
+ #
41
+ # @faker.version 1.9.3
18
42
  def planet
19
43
  fetch('dune.planets')
20
44
  end
21
45
 
46
+ ##
47
+ # Produces a quote from Dune
48
+ #
49
+ # @param character [String] The name of the character that the quote should be from
50
+ #
51
+ # @return [String]
52
+ #
53
+ # @example
54
+ # Faker::Books::Dune.quote
55
+ # #=> "A dead man, surely, no longer requires that water."
56
+ # @example
57
+ # Faker::Books::Dune.quote(character: "baron_harkonnen")
58
+ # #=> "He who controls the spice, controls the universe!"
59
+ #
60
+ # @faker.version 1.9.3
22
61
  def quote(legacy_character = NOT_GIVEN, character: nil)
23
- if legacy_character != NOT_GIVEN
24
- warn_with_uplevel 'Passing `character` with the 1st argument of `Dune.quote` is deprecated. Use keyword argument like `Dune.quote(character: ...)` instead.', uplevel: 1
25
- character = legacy_character
62
+ warn_for_deprecated_arguments do |keywords|
63
+ keywords << :character if legacy_character != NOT_GIVEN
26
64
  end
27
65
 
28
66
  quoted_characters = translate('faker.dune.quotes').keys
@@ -41,10 +79,23 @@ module Faker
41
79
  fetch('dune.quotes.' + character)
42
80
  end
43
81
 
82
+ ##
83
+ # Produces a saying from Dune
84
+ #
85
+ # @param source [String]
86
+ #
87
+ # @return [String]
88
+ #
89
+ # @example
90
+ # Faker::Books::Dune.saying #=> "You do not beg the sun for mercy."
91
+ # @example
92
+ # Faker::Books::Dune.saying(source: "fremen")
93
+ # #=> "May thy knife chip and shatter."
94
+ #
95
+ # @faker.version 1.9.3
44
96
  def saying(legacy_source = NOT_GIVEN, source: nil)
45
- if legacy_source != NOT_GIVEN
46
- warn_with_uplevel 'Passing `source` with the 1st argument of `Dune.saying` is deprecated. Use keyword argument like `Dune.saying(source: ...)` instead.', uplevel: 1
47
- source = legacy_source
97
+ warn_for_deprecated_arguments do |keywords|
98
+ keywords << :source if legacy_source != NOT_GIVEN
48
99
  end
49
100
 
50
101
  sourced_sayings = translate('faker.dune.sayings').keys
@@ -4,53 +4,140 @@ module Faker
4
4
  class Books
5
5
  class Lovecraft < Base
6
6
  class << self
7
+ ##
8
+ # Produces the name of a location
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Books::Lovecraft.location #=> "Kingsport"
14
+ #
15
+ # @faker.version 1.9.3
7
16
  def location
8
17
  fetch('lovecraft.location')
9
18
  end
10
19
 
20
+ ##
21
+ # @param number [Integer] The number of times to repeat the chant
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::Books::Lovecraft.fhtagn
26
+ # #=> "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn"
27
+ # @example
28
+ # Faker::Books::Lovecraft.fhtagn(number: 3)
29
+ # #=> "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fht...
30
+ #
31
+ # @faker.version 1.9.3
11
32
  def fhtagn(legacy_number = NOT_GIVEN, number: 1)
12
- if legacy_number != NOT_GIVEN
13
- warn_with_uplevel 'Passing `number` with the 1st argument of `Lovecraft.fhtagn` is deprecated. Use keyword argument like `Lovecraft.fhtagn(number: ...)` instead.', uplevel: 1
14
- number = legacy_number
33
+ warn_for_deprecated_arguments do |keywords|
34
+ keywords << :number if legacy_number != NOT_GIVEN
15
35
  end
16
36
 
17
37
  Array.new(number) { fetch('lovecraft.fhtagn') }.join('. ')
18
38
  end
19
39
 
40
+ ##
41
+ # Produces the name of a deity
42
+ #
43
+ # @return [String]
44
+ #
45
+ # @example
46
+ # Faker::Books::Lovecraft.deity #=> "Shub-Niggurath"
47
+ #
48
+ # @faker.version 1.9.3
20
49
  def deity
21
50
  fetch('lovecraft.deity')
22
51
  end
23
52
 
53
+ ##
54
+ # Produces the name of a tome
55
+ #
56
+ # @return [String]
57
+ #
58
+ # @example
59
+ # Faker::Books::Lovecraft.tome #=> "Book of Eibon"
60
+ #
61
+ # @faker.version 1.9.3
24
62
  def tome
25
63
  fetch('lovecraft.tome')
26
64
  end
27
65
 
66
+ ##
67
+ # Produces a random sentence
68
+ #
69
+ # @param word_count [Integer] The number of words to have in the sentence
70
+ # @param random_words_to_add [Integer]
71
+ #
72
+ # @return [String]
73
+ #
74
+ # @example
75
+ # Faker::Books::Lovecraft.sentence
76
+ # #=> "Furtive antiquarian squamous dank cat loathsome amorphous lurk."
77
+ # @example
78
+ # Faker::Books::Lovecraft.sentence(word_count: 3)
79
+ # #=> "Daemoniac antediluvian fainted squamous comprehension gambrel nameless singular."
80
+ # @example
81
+ # Faker::Books::Lovecraft.sentence(word_count: 3, random_words_to_add: 1)
82
+ # #=> "Amorphous indescribable tenebrous."
83
+ #
84
+ # @faker.version 1.9.3
28
85
  def sentence(legacy_word_count = NOT_GIVEN, legacy_random_words_to_add = NOT_GIVEN, word_count: 4, random_words_to_add: 6)
29
- if legacy_word_count != NOT_GIVEN
30
- warn_with_uplevel 'Passing `word_count` with the 1st argument of `Lovecraft.sentence` is deprecated. Use keyword argument like `Lovecraft.sentence(word_count: ...)` instead.', uplevel: 1
31
- word_count = legacy_word_count
32
- end
33
- if legacy_random_words_to_add != NOT_GIVEN
34
- warn_with_uplevel 'Passing `random_words_to_add` with the 2nd argument of `Lovecraft.sentence` is deprecated. Use keyword argument like `Lovecraft.sentence(random_words_to_add: ...)` instead.', uplevel: 1
35
- random_words_to_add = legacy_random_words_to_add
86
+ warn_for_deprecated_arguments do |keywords|
87
+ keywords << :word_count if legacy_word_count != NOT_GIVEN
88
+ keywords << :random_words_to_add if legacy_random_words_to_add != NOT_GIVEN
36
89
  end
37
90
 
38
91
  words(number: word_count + rand(random_words_to_add.to_i).to_i, spaces_allowed: true).join(' ').capitalize + '.'
39
92
  end
40
93
 
94
+ ##
95
+ # Produces a random word
96
+ #
97
+ # @return [String]
98
+ #
99
+ # @example
100
+ # Faker::Books::Lovecraft.word #=> "furtive"
101
+ #
102
+ # @faker.version 1.9.3
41
103
  def word
42
104
  random_word = sample(translate('faker.lovecraft.words'))
43
105
  random_word =~ /\s/ ? word : random_word
44
106
  end
45
107
 
108
+ ##
109
+ # Produces a array of random words
110
+ #
111
+ # @param number [Integer] Number of words to generate
112
+ # @param spaces_allowed [Boolean] If true, generated words can contain spaces
113
+ #
114
+ # @return [Array<String>]
115
+ #
116
+ # @example
117
+ # Faker::Books::Lovecraft.words
118
+ # #=> [
119
+ # # "manuscript",
120
+ # # "abnormal",
121
+ # # "singular",
122
+ # # ]
123
+ # @example
124
+ # Faker::Books::Lovecraft.words(number: 2)
125
+ # #=> [
126
+ # # "daemoniac",
127
+ # # "cat",
128
+ # # ]
129
+ # @example
130
+ # Faker::Books::Lovecraft.words(number: 2, spaces_allowed: 1)
131
+ # #=> [
132
+ # # "lurk",
133
+ # # "charnel",
134
+ # # ]
135
+ #
136
+ # @faker.version 1.9.3
46
137
  def words(legacy_number = NOT_GIVEN, legacy_spaces_allowed = NOT_GIVEN, number: 3, spaces_allowed: false)
47
- if legacy_number != NOT_GIVEN
48
- warn_with_uplevel 'Passing `number` with the 1st argument of `Lovecraft.words` is deprecated. Use keyword argument like `Lovecraft.words(number: ...)` instead.', uplevel: 1
49
- number = legacy_number
50
- end
51
- if legacy_spaces_allowed != NOT_GIVEN
52
- warn_with_uplevel 'Passing `spaces_allowed` with the 2nd argument of `Lovecraft.words` is deprecated. Use keyword argument like `Lovecraft.words(spaces_allowed: ...)` instead.', uplevel: 1
53
- spaces_allowed = legacy_spaces_allowed
138
+ warn_for_deprecated_arguments do |keywords|
139
+ keywords << :number if legacy_number != NOT_GIVEN
140
+ keywords << :spaces_allowed if legacy_spaces_allowed != NOT_GIVEN
54
141
  end
55
142
 
56
143
  resolved_num = resolve(number)
@@ -63,10 +150,31 @@ module Faker
63
150
  words.each_with_index { |w, i| words[i] = word if w =~ /\s/ }
64
151
  end
65
152
 
153
+ ##
154
+ # Produces a array of random sentences
155
+ #
156
+ # @param number [Integer] Number of sentences to generate
157
+ #
158
+ # @return [Array<String>]
159
+ #
160
+ # @example
161
+ # Faker::Books::Lovecraft.sentences
162
+ # #=> [
163
+ # # "Nameless loathsome decadent gambrel.",
164
+ # # "Ululate swarthy immemorial cat madness gibbous unmentionable unnamable.",
165
+ # # "Decadent antediluvian non-euclidean tentacles amorphous tenebrous.",
166
+ # # ]
167
+ # @example
168
+ # Faker::Books::Lovecraft.sentences(number: 2)
169
+ # #=> [
170
+ # # "Antediluvian amorphous unmentionable singular accursed squamous immemorial.",
171
+ # # "Gambrel daemoniac gibbous stygian shunned ululate iridescence abnormal.",
172
+ # # ]
173
+ #
174
+ # @faker.version 1.9.3
66
175
  def sentences(legacy_number = NOT_GIVEN, number: 3)
67
- if legacy_number != NOT_GIVEN
68
- warn_with_uplevel 'Passing `number` with the 1st argument of `Lovecraft.sentences` is deprecated. Use keyword argument like `Lovecraft.sentences(number: ...)` instead.', uplevel: 1
69
- number = legacy_number
176
+ warn_for_deprecated_arguments do |keywords|
177
+ keywords << :number if legacy_number != NOT_GIVEN
70
178
  end
71
179
 
72
180
  [].tap do |sentences|
@@ -76,23 +184,59 @@ module Faker
76
184
  end
77
185
  end
78
186
 
187
+ ##
188
+ # Produces a random paragraph
189
+ #
190
+ # @param sentence_count [Integer] Number of sentences to generate
191
+ # @param random_sentences_to_add [Integer]
192
+ #
193
+ # @return [String]
194
+ #
195
+ # @example
196
+ # Faker::Books::Lovecraft.paragraph
197
+ # #=> "Squamous nameless daemoniac fungus ululate. Cyclopean stygian decadent loathsome manuscript tenebrous. Foetid abnormal stench. Dank non-euclidean comprehension eldritch. Charnel singular shunned lurk effulgence fungus."
198
+ # @example
199
+ # Faker::Books::Lovecraft.paragraph(sentence_count: 2)
200
+ # #=> "Decadent lurk tenebrous loathsome furtive spectral amorphous gibbous. Gambrel eldritch daemoniac cat madness comprehension stygian effulgence."
201
+ # @example
202
+ # Faker::Books::Lovecraft.paragraph(sentence_count: 1, random_sentences_to_add: 1)
203
+ # #=> "Stench cyclopean fainted antiquarian nameless. Antiquarian ululate tenebrous non-euclidean effulgence."
204
+ #
205
+ # @faker.version 1.9.3
79
206
  def paragraph(legacy_sentence_count = NOT_GIVEN, legacy_random_sentences_to_add = NOT_GIVEN, sentence_count: 3, random_sentences_to_add: 3)
80
- if legacy_sentence_count != NOT_GIVEN
81
- warn_with_uplevel 'Passing `sentence_count` with the 1st argument of `Lovecraft.paragraph` is deprecated. Use keyword argument like `Lovecraft.paragraph(sentence_count: ...)` instead.', uplevel: 1
82
- sentence_count = legacy_sentence_count
83
- end
84
- if legacy_random_sentences_to_add != NOT_GIVEN
85
- warn_with_uplevel 'Passing `random_sentences_to_add` with the 2nd argument of `Lovecraft.paragraph` is deprecated. Use keyword argument like `Lovecraft.paragraph(random_sentences_to_add: ...)` instead.', uplevel: 1
86
- random_sentences_to_add = legacy_random_sentences_to_add
207
+ warn_for_deprecated_arguments do |keywords|
208
+ keywords << :sentence_count if legacy_sentence_count != NOT_GIVEN
209
+ keywords << :random_sentences_to_add if legacy_random_sentences_to_add != NOT_GIVEN
87
210
  end
88
211
 
89
212
  sentences(number: resolve(sentence_count) + rand(random_sentences_to_add.to_i).to_i).join(' ')
90
213
  end
91
214
 
215
+ ##
216
+ # Produces a array of random paragraphs
217
+ #
218
+ # @param number [Integer] Number of paragraphs to generate
219
+ #
220
+ # @return [Array<String>]
221
+ #
222
+ # @example
223
+ # Faker::Books::Lovecraft.paragraphs
224
+ # #=> [
225
+ # # "Noisome daemoniac gibbous abnormal antediluvian. Unutterable fung...
226
+ # # "Non-euclidean immemorial indescribable accursed furtive. Dank unn...
227
+ # # "Charnel antediluvian unnamable cat blasphemous comprehension tene...
228
+ # # ]
229
+ # @example
230
+ # Faker::Books::Lovecraft.paragraphs(number: 2)
231
+ # #=> [
232
+ # # "Hideous amorphous manuscript antediluvian non-euclidean cat eldri...
233
+ # # "Tenebrous unnamable comprehension antediluvian lurk. Lurk spectra...
234
+ # # ]
235
+ #
236
+ # @faker.version 1.9.3
92
237
  def paragraphs(legacy_number = NOT_GIVEN, number: 3)
93
- if legacy_number != NOT_GIVEN
94
- warn_with_uplevel 'Passing `number` with the 1st argument of `Lovecraft.paragraphs` is deprecated. Use keyword argument like `Lovecraft.paragraphs(number: ...)` instead.', uplevel: 1
95
- number = legacy_number
238
+ warn_for_deprecated_arguments do |keywords|
239
+ keywords << :number if legacy_number != NOT_GIVEN
96
240
  end
97
241
 
98
242
  [].tap do |paragraphs|
@@ -102,10 +246,22 @@ module Faker
102
246
  end
103
247
  end
104
248
 
249
+ ##
250
+ # @param characters [Integer] Number of characters to generate in the paragraph
251
+ #
252
+ # @return [String]
253
+ #
254
+ # @example
255
+ # Faker::Books::Lovecraft.paragraph_by_chars
256
+ # #=> "Truffaut stumptown trust fund 8-bit messenger bag portland. Meh kombucha selvage swag biodiesel. Lomo kinfolk jean shorts asymmetrical diy. Wayfarers portland twee stumptown. Wes anderson biodiesel retro 90's pabst. Diy echo 90's mixtape semiotics. Cornho."
257
+ # @example
258
+ # Faker::Books::Lovecraft.paragraph_by_chars(characters: 128)
259
+ # #=> "Effulgence madness noisome. Fungus stygian mortal madness amorphous dank. Decadent noisome hideous effulgence. Tentacles charne."
260
+ #
261
+ # @faker.version 1.9.3
105
262
  def paragraph_by_chars(legacy_characters = NOT_GIVEN, characters: 256)
106
- if legacy_characters != NOT_GIVEN
107
- warn_with_uplevel 'Passing `characters` with the 1st argument of `Lovecraft.paragraph_by_chars` is deprecated. Use keyword argument like `Lovecraft.paragraph_by_chars(characters: ...)` instead.', uplevel: 1
108
- characters = legacy_characters
263
+ warn_for_deprecated_arguments do |keywords|
264
+ keywords << :characters if legacy_characters != NOT_GIVEN
109
265
  end
110
266
 
111
267
  paragraph = paragraph(sentence_count: 3)