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
@@ -40,9 +40,12 @@ module Faker
40
40
  class Base
41
41
  Numbers = Array(0..9)
42
42
  ULetters = Array('A'..'Z')
43
- Letters = ULetters + Array('a'..'z')
43
+ LLetters = Array('a'..'z')
44
+ Letters = ULetters + LLetters
44
45
 
45
46
  class << self
47
+ NOT_GIVEN = Object.new
48
+
46
49
  ## by default numerify results do not start with a zero
47
50
  def numerify(number_string, leading_zero: false)
48
51
  return number_string.gsub(/#/) { rand(10).to_s } if leading_zero
@@ -245,6 +248,58 @@ module Faker
245
248
  ensure
246
249
  I18n.enforce_available_locales = old_enforce_available_locales
247
250
  end
251
+
252
+ private
253
+
254
+ def warn_for_deprecated_arguments
255
+ keywords = []
256
+ yield(keywords)
257
+
258
+ return if keywords.empty?
259
+
260
+ method_name = caller.first.match(/`(?<method_name>.*)'/)[:method_name]
261
+
262
+ keywords.each.with_index(1) do |keyword, index|
263
+ i = case index
264
+ when 1 then '1st'
265
+ when 2 then '2nd'
266
+ when 3 then '3rd'
267
+ else "#{index}th"
268
+ end
269
+
270
+ warn_with_uplevel(<<~MSG, uplevel: 5)
271
+ Passing `#{keyword}` with the #{i} argument of `#{method_name}` is deprecated. Use keyword argument like `#{method_name}(#{keyword}: ...)` instead.
272
+ MSG
273
+ end
274
+
275
+ warn(<<~MSG)
276
+
277
+ To automatically update from positional arguments to keyword arguments,
278
+ install rubocop-faker and run:
279
+
280
+ rubocop \\
281
+ --require rubocop-faker \\
282
+ --only Faker/DeprecatedArguments \\
283
+ --auto-correct
284
+
285
+ MSG
286
+ end
287
+
288
+ # Workaround for emulating `warn '...', uplevel: 1` in Ruby 2.4 or lower.
289
+ def warn_with_uplevel(message, uplevel: 1)
290
+ at = parse_caller(caller[uplevel]).join(':')
291
+ warn "#{at}: #{message}"
292
+ end
293
+
294
+ def parse_caller(at)
295
+ # rubocop:disable Style/GuardClause
296
+ if /^(.+?):(\d+)(?::in `.*')?/ =~ at
297
+ file = Regexp.last_match(1)
298
+ line = Regexp.last_match(2).to_i
299
+ [file, line]
300
+ end
301
+ # rubocop:enable Style/GuardClause
302
+ end
248
303
  end
249
304
  end
250
305
  end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Faker
4
+ class Blockchain
5
+ class Aeternity < Base
6
+ class << self
7
+ ##
8
+ # Produces a random Aeternity wallet address
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Blockchain::Aeternity.address
14
+ # #=> "ak_zvU8YQLagjcfng7Tg8yCdiZ1rpiWNp1PBn3vtUs44utSvbJVR"
15
+ #
16
+ def address
17
+ 'ak_' + rand_strings
18
+ end
19
+
20
+ ##
21
+ # Produces a random Aeternity transaction
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Blockchain::Aeternity.transaction
27
+ # #=> "th_147nDP22h3pHrLt2qykTH4txUwQh1ccaXp"
28
+ #
29
+ def transaction
30
+ 'th_' + rand_strings(51)
31
+ end
32
+
33
+ ##
34
+ # Produces a random Aeternity contract
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Blockchain::Aeternity.contract
40
+ # #=> "ct_Hk2JsNeWGEYQEHHQCfcBeGrwbhtYSwFTPdDhW2SvjFYVojyhW"
41
+ #
42
+ def contract
43
+ 'ct_' + rand_strings
44
+ end
45
+
46
+ ##
47
+ # Produces a random Aeternity oracle
48
+ #
49
+ # @return [String]
50
+ #
51
+ # @example
52
+ # Faker::Blockchain::Aeternity.oracle
53
+ # #=> "ok_28QDg7fkF5qiKueSdUvUBtCYPJdmMEoS73CztzXCRAwMGKHKZh"
54
+ #
55
+ def oracle
56
+ 'ok_' + rand_strings(51)
57
+ end
58
+
59
+ protected
60
+
61
+ def rand_strings(length = 50)
62
+ hex_alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
63
+ var = +''
64
+ length.times { var << sample(shuffle(hex_alphabet.split(''))) }
65
+ var
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -7,21 +7,47 @@ module Faker
7
7
  class Blockchain
8
8
  class Bitcoin < Base
9
9
  class << self
10
+ # @private
10
11
  PROTOCOL_VERSIONS = {
11
12
  main: 0,
12
13
  testnet: 111
13
14
  }.freeze
14
15
 
16
+ ##
17
+ # Produces a Bitcoin wallet address
18
+ #
19
+ # @return [String]
20
+ #
21
+ # @example
22
+ # Faker::Blockchain::Bitcoin.address
23
+ # #=> "147nDP22h3pHrLt2qykTH4txUwQh1ccaXp"
24
+ #
25
+ # @faker.version 1.9.2
15
26
  def address
16
27
  address_for(:main)
17
28
  end
18
29
 
30
+ ##
31
+ # Produces a Bitcoin testnet address
32
+ #
33
+ # @return [String]
34
+ #
35
+ # @example
36
+ # Faker::Blockchain::Bitcoin.testnet_address
37
+ # #=> "n4YjRyYD6V6zREpk6opqESDqD3KYnMdVEB"
38
+ #
39
+ # @faker.version 1.9.2
19
40
  def testnet_address
20
41
  address_for(:testnet)
21
42
  end
22
43
 
23
44
  protected
24
45
 
46
+ ##
47
+ # Generates a random Bitcoin address for the given network
48
+ #
49
+ # @param network [Symbol] The name of network protocol to generate an address for
50
+ # @return [String] A Bitcoin address
25
51
  def address_for(network)
26
52
  version = PROTOCOL_VERSIONS.fetch(network)
27
53
  packed = version.chr + Faker::Config.random.bytes(20)
@@ -4,6 +4,16 @@ module Faker
4
4
  class Blockchain
5
5
  class Ethereum < Base
6
6
  class << self
7
+ ##
8
+ # Produces a random Ethereum wallet address
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Blockchain::Ethereum.address
14
+ # #=> "0xd392b0c0500700d02d27ab30805ec80ddd3320ff"
15
+ #
16
+ # @faker.version 1.9.1
7
17
  def address
8
18
  hex_alphabet = '0123456789abcdef'
9
19
  var = +'0x'
@@ -7,38 +7,94 @@ module Faker
7
7
  class Blockchain
8
8
  class Tezos < Base
9
9
  class << self
10
+ # @private
10
11
  PREFIXES = {
11
- tz1: [6, 161, 159],
12
- KT1: [2, 90, 121],
13
- edpk: [13, 15, 37, 217],
14
- edsk: [13, 15, 58, 7],
12
+ tz1: [6, 161, 159],
13
+ KT1: [2, 90, 121],
14
+ edpk: [13, 15, 37, 217],
15
+ edsk: [13, 15, 58, 7],
15
16
  edsig: [9, 245, 205, 134, 18],
16
- B: [1, 52],
17
- o: [5, 116]
17
+ B: [1, 52],
18
+ o: [5, 116]
18
19
  }.freeze
19
20
 
21
+ ##
22
+ # Produces a random Tezos account address
23
+ #
24
+ # @return [String]
25
+ #
26
+ # @example
27
+ # Faker::Blockchain::Tezos.account
28
+ # #=> "tz1eUsgK6aj752Fbxwk5sAoEFvSDnPjZ4qvk"
29
+ #
30
+ # @faker.version 1.9.2
20
31
  def account
21
32
  encode_tz(:tz1, 20)
22
33
  end
23
34
 
35
+ ##
36
+ # Produces a random Tezos contract
37
+ #
38
+ # @return [String]
39
+ #
40
+ # @example
41
+ # Faker::Blockchain::Tezos.contract
42
+ # #=> "KT1MroqeP15nnitB4CnNfkqHYa2NErhPPLWF"
43
+ #
44
+ # @faker.version 1.9.2
24
45
  def contract
25
46
  encode_tz(:KT1, 20)
26
47
  end
27
48
 
49
+ ##
50
+ # Produces a random Tezos operation
51
+ #
52
+ # @return [String]
53
+ #
54
+ # @example
55
+ # Faker::Blockchain::Tezos.operation
56
+ # #=> "onygWYXJX3xNstFLv9PcCrhQdCkENC795xwSinmTEc1jsDN4VDa"
57
+ #
58
+ # @faker.version 1.9.2
28
59
  def operation
29
60
  encode_tz(:o, 32)
30
61
  end
31
62
 
63
+ ##
64
+ # Produces a random Tezos block
65
+ #
66
+ # @return [String]
67
+ #
68
+ # @example
69
+ # Faker::Blockchain::Tezos.block
70
+ # #=> "BMbhs2rkY1dvAkAyRytvPsjFQ2RiPrBhYkxvWpY65dzkdSuw58a"
71
+ #
72
+ # @faker.version 1.9.4
32
73
  def block
33
74
  encode_tz(:B, 32)
34
75
  end
35
76
 
77
+ ##
78
+ # Produces a random Tezos signature
79
+ #
80
+ # @return [String]
81
+ #
82
+ # @example
83
+ # Faker::Blockchain::Tezos.signature
84
+ # #=> "edsigu165B7VFf3Dpw2QABVzEtCxJY2gsNBNcE3Ti7rRxtDUjqTFRpg67EdAQmY6YWPE5tKJDMnSTJDFu65gic8uLjbW2YwGvAZ"
85
+ #
86
+ # @faker.version 1.9.2
36
87
  def signature
37
88
  encode_tz(:edsig, 64)
38
89
  end
39
90
 
40
91
  protected
41
92
 
93
+ ##
94
+ # @param prefix [Symbol]
95
+ # @param payload_size [Integer] The size of the payload
96
+ #
97
+ # @return [String]
42
98
  def encode_tz(prefix, payload_size)
43
99
  prefix = PREFIXES.fetch(prefix)
44
100
  packed = prefix.map(&:chr).join('') + Faker::Config.random.bytes(payload_size)
@@ -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,24 +2,67 @@
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
 
22
- def quote(character = nil)
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
61
+ def quote(legacy_character = NOT_GIVEN, character: nil)
62
+ warn_for_deprecated_arguments do |keywords|
63
+ keywords << :character if legacy_character != NOT_GIVEN
64
+ end
65
+
23
66
  quoted_characters = translate('faker.dune.quotes').keys
24
67
 
25
68
  if character.nil?
@@ -36,7 +79,25 @@ module Faker
36
79
  fetch('dune.quotes.' + character)
37
80
  end
38
81
 
39
- def saying(source = nil)
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
96
+ def saying(legacy_source = NOT_GIVEN, source: nil)
97
+ warn_for_deprecated_arguments do |keywords|
98
+ keywords << :source if legacy_source != NOT_GIVEN
99
+ end
100
+
40
101
  sourced_sayings = translate('faker.dune.sayings').keys
41
102
 
42
103
  if source.nil?