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
@@ -4,6 +4,15 @@ module Faker
4
4
  class Creature
5
5
  class Animal < Base
6
6
  class << self
7
+ ##
8
+ # Produces a random animal name
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Creature::Animal.name #=> "fly"
14
+ #
15
+ # @faker.version 1.9.2
7
16
  def name
8
17
  fetch('creature.animal.name')
9
18
  end
@@ -6,14 +6,41 @@ module Faker
6
6
  flexible :cat
7
7
 
8
8
  class << self
9
+ ##
10
+ # Produces a random name for a cat
11
+ #
12
+ # @return [String]
13
+ #
14
+ # @example
15
+ # Faker::Creature::Cat.name #=> "Felix"
16
+ #
17
+ # @faker.version 1.9.2
9
18
  def name
10
19
  fetch('creature.cat.name')
11
20
  end
12
21
 
22
+ ##
23
+ # Produces a random cat breed
24
+ #
25
+ # @return [String]
26
+ #
27
+ # @example
28
+ # Faker::Creature::Cat.breed #=> "Scottish Fold"
29
+ #
30
+ # @faker.version 1.9.2
13
31
  def breed
14
32
  fetch('creature.cat.breed')
15
33
  end
16
34
 
35
+ ##
36
+ # Produces a random cat breed registry
37
+ #
38
+ # @return [String]
39
+ #
40
+ # @example
41
+ # Faker::Creature::Cat.registry #=> "Fancy Southern Africa Cat Council"
42
+ #
43
+ # @faker.version 1.9.2
17
44
  def registry
18
45
  fetch('creature.cat.registry')
19
46
  end
@@ -6,34 +6,106 @@ module Faker
6
6
  flexible :dog
7
7
 
8
8
  class << self
9
+ ##
10
+ # Produces a random name for a dog
11
+ #
12
+ # @return [String]
13
+ #
14
+ # @example
15
+ # Faker::Creature::Dog.name #=> "Spike"
16
+ #
17
+ # @faker.version 1.9.2
9
18
  def name
10
19
  fetch('creature.dog.name')
11
20
  end
12
21
 
22
+ ##
23
+ # Produces a random dog breed
24
+ #
25
+ # @return [String]
26
+ #
27
+ # @example
28
+ # Faker::Creature::Dog.breed #=> "Yorkshire Terrier"
29
+ #
30
+ # @faker.version 1.9.2
13
31
  def breed
14
32
  fetch('creature.dog.breed')
15
33
  end
16
34
 
35
+ ##
36
+ # Produces a random sound made by a dog
37
+ #
38
+ # @return [String]
39
+ #
40
+ # @example
41
+ # Faker::Creature::Dog.sound #=> "woof woof"
42
+ #
43
+ # @faker.version 1.9.2
17
44
  def sound
18
45
  fetch('creature.dog.sound')
19
46
  end
20
47
 
48
+ ##
49
+ # Produces a random dog meme phrase
50
+ #
51
+ # @return [String]
52
+ #
53
+ # @example
54
+ # Faker::Creature::Dog.meme_phrase #=> "smol pupperino"
55
+ #
56
+ # @faker.version 1.9.2
21
57
  def meme_phrase
22
58
  fetch('creature.dog.meme_phrase')
23
59
  end
24
60
 
61
+ ##
62
+ # Produces a random dog age
63
+ #
64
+ # @return [String]
65
+ #
66
+ # @example
67
+ # Faker::Creature::Dog.age #=> "puppy"
68
+ #
69
+ # @faker.version 1.9.2
25
70
  def age
26
71
  fetch('creature.dog.age')
27
72
  end
28
73
 
74
+ ##
75
+ # Produces a random gender
76
+ #
77
+ # @return [String]
78
+ #
79
+ # @example
80
+ # Faker::Creature::Dog.gender #=> "Female"
81
+ #
82
+ # @faker.version 1.9.2
29
83
  def gender
30
84
  Faker::Gender.binary_type
31
85
  end
32
86
 
87
+ ##
88
+ # Produces a random coat length
89
+ #
90
+ # @return [String]
91
+ #
92
+ # @example
93
+ # Faker::Creature::Dog.coat_length #=> "short"
94
+ #
95
+ # @faker.version 1.9.2
33
96
  def coat_length
34
97
  fetch('creature.dog.coat_length')
35
98
  end
36
99
 
100
+ ##
101
+ # Produces a random size of a dog
102
+ #
103
+ # @return [String]
104
+ #
105
+ # @example
106
+ # Faker::Creature::Dog.size #=> "small"
107
+ #
108
+ # @faker.version 1.9.2
37
109
  def size
38
110
  fetch('creature.dog.size')
39
111
  end
@@ -6,10 +6,28 @@ module Faker
6
6
  flexible :horse
7
7
 
8
8
  class << self
9
+ ##
10
+ # Produces a random name for a horse
11
+ #
12
+ # @return [String]
13
+ #
14
+ # @example
15
+ # Faker::Creature::Horse.name #=> "Noir"
16
+ #
17
+ # @faker.version 1.9.2
9
18
  def name
10
19
  fetch('creature.horse.name')
11
20
  end
12
21
 
22
+ ##
23
+ # Produces a random horse breed
24
+ #
25
+ # @return [String]
26
+ #
27
+ # @example
28
+ # Faker::Creature::Horse.breed #=> "Spanish Barb see Barb Horse"
29
+ #
30
+ # @faker.version 1.9.2
13
31
  def breed
14
32
  fetch('creature.horse.breed')
15
33
  end
@@ -6,9 +6,8 @@ module Faker
6
6
 
7
7
  class << self
8
8
  def city(legacy_options = NOT_GIVEN, options: {})
9
- if legacy_options != NOT_GIVEN
10
- warn_with_uplevel 'Passing `options` with the 1st argument of `Address.city` is deprecated. Use keyword argument like `Address.city(options: ...)` instead.', uplevel: 1
11
- options = legacy_options
9
+ warn_for_deprecated_arguments do |keywords|
10
+ keywords << :options if legacy_options != NOT_GIVEN
12
11
  end
13
12
 
14
13
  parse(options[:with_state] ? 'address.city_with_state' : 'address.city')
@@ -19,9 +18,8 @@ module Faker
19
18
  end
20
19
 
21
20
  def street_address(legacy_include_secondary = NOT_GIVEN, include_secondary: false)
22
- if legacy_include_secondary != NOT_GIVEN
23
- warn_with_uplevel 'Passing `include_secondary` with the 1st argument of `Address.street_address` is deprecated. Use keyword argument like `Address.street_address(include_secondary: ...)` instead.', uplevel: 1
24
- include_secondary = legacy_include_secondary
21
+ warn_for_deprecated_arguments do |keywords|
22
+ keywords << :include_secondary if legacy_include_secondary != NOT_GIVEN
25
23
  end
26
24
 
27
25
  numerify(parse('address.street_address') + (include_secondary ? ' ' + secondary_address : ''))
@@ -40,9 +38,8 @@ module Faker
40
38
  end
41
39
 
42
40
  def zip_code(legacy_state_abbreviation = NOT_GIVEN, state_abbreviation: '')
43
- if legacy_state_abbreviation != NOT_GIVEN
44
- warn_with_uplevel 'Passing `state_abbreviation` with the 1st argument of `Address.zip_code` is deprecated. Use keyword argument like `Address.zip_code(state_abbreviation: ...)` instead.', uplevel: 1
45
- state_abbreviation = legacy_state_abbreviation
41
+ warn_for_deprecated_arguments do |keywords|
42
+ keywords << :state_abbreviation if legacy_state_abbreviation != NOT_GIVEN
46
43
  end
47
44
 
48
45
  if state_abbreviation.empty?
@@ -87,18 +84,16 @@ module Faker
87
84
  end
88
85
 
89
86
  def country_by_code(legacy_code = NOT_GIVEN, code: 'US')
90
- if legacy_code != NOT_GIVEN
91
- warn_with_uplevel 'Passing `code` with the 1st argument of `Address.country_by_code` is deprecated. Use keyword argument like `Address.country_by_code(code: ...)` instead.', uplevel: 1
92
- code = legacy_code
87
+ warn_for_deprecated_arguments do |keywords|
88
+ keywords << :code if legacy_code != NOT_GIVEN
93
89
  end
94
90
 
95
91
  fetch('address.country_by_code.' + code)
96
92
  end
97
93
 
98
94
  def country_name_to_code(legacy_name = NOT_GIVEN, name: 'united_states')
99
- if legacy_name != NOT_GIVEN
100
- warn_with_uplevel 'Passing `name` with the 1st argument of `Address.country_name_to_code` is deprecated. Use keyword argument like `Address.country_name_to_code(name: ...)` instead.', uplevel: 1
101
- name = legacy_name
95
+ warn_for_deprecated_arguments do |keywords|
96
+ keywords << :name if legacy_name != NOT_GIVEN
102
97
  end
103
98
 
104
99
  fetch('address.country_by_name.' + name)
@@ -2,13 +2,26 @@
2
2
 
3
3
  module Faker
4
4
  class Alphanumeric < Base
5
+ ##
6
+ # List of characters allowed for alphanumeric strings
7
+ # @private
5
8
  ALPHANUMS = LLetters + Numbers
6
9
 
7
10
  class << self
11
+ ##
12
+ # Produces a random string of alphabetic characters (no digits)
13
+ #
14
+ # @param number [Integer] The length of the string to generate
15
+ #
16
+ # @return [String]
17
+ #
18
+ # @example
19
+ # Faker::Alphanumeric.alpha(number: 10) #=> "zlvubkrwga"
20
+ #
21
+ # @faker.version 1.9.2
8
22
  def alpha(legacy_number = NOT_GIVEN, number: 32)
9
- if legacy_number != NOT_GIVEN
10
- warn_with_uplevel 'Passing `number` with the 1st argument of `Alphanumeric.alpha` is deprecated. Use keyword argument like `Alphanumeric.alpha(number: ...)` instead.', uplevel: 1
11
- number = legacy_number
23
+ warn_for_deprecated_arguments do |keywords|
24
+ keywords << :number if legacy_number != NOT_GIVEN
12
25
  end
13
26
  char_count = resolve(number)
14
27
  return '' if char_count.to_i < 1
@@ -19,34 +32,32 @@ module Faker
19
32
  ##
20
33
  # Produces a random string of alphanumeric characters
21
34
  #
22
- # @param [Integer] number
23
- # @param [Integer] min_alpha
24
- # @param [Integer] min_numeric
35
+ # @param number [Integer] The number of characters to generate
36
+ # @param min_alpha [Integer] The minimum number of alphabetic to add to the string
37
+ # @param min_numeric [Integer] The minimum number of numbers to add to the string
25
38
  #
26
39
  # @return [String]
27
40
  #
28
- # @example Faker::Alphanumeric.alphanumeric(number: 10) #=> "3yfq2phxtb"
29
- # @example Faker::Alphanumeric.alphanumeric(number: 10, min_alpha: 3) #=> "3yfq2phxtb"
30
- # @example Faker::Alphanumeric.alphanumeric(number: 10, min_alpha: 3, min_numeric: 3) #=> "3yfq2phx8b"
41
+ # @example
42
+ # Faker::Alphanumeric.alphanumeric(number: 10) #=> "3yfq2phxtb"
43
+ # @example
44
+ # Faker::Alphanumeric.alphanumeric(number: 10, min_alpha: 3) #=> "3yfq2phxtb"
45
+ # @example
46
+ # Faker::Alphanumeric.alphanumeric(number: 10, min_alpha: 3, min_numeric: 3) #=> "3yfq2phx8b"
31
47
  #
32
48
  # @faker.version 2.1.3
33
49
  def alphanumeric(legacy_number = NOT_GIVEN, number: 32, min_alpha: 0, min_numeric: 0)
34
- if legacy_number != NOT_GIVEN
35
- warn_with_uplevel 'Passing `number` with the 1st argument of `Alphanumeric.alphanumeric` is deprecated. Use keyword argument like `Alphanumeric.alphanumeric(number: ...)` instead.', uplevel: 1
36
- number = legacy_number
50
+ warn_for_deprecated_arguments do |keywords|
51
+ keywords << :number if legacy_number != NOT_GIVEN
37
52
  end
38
53
  char_count = resolve(number)
39
54
  return '' if char_count.to_i < 1
40
55
  raise ArgumentError, 'min_alpha must be greater than or equal to 0' if min_alpha&.negative?
41
56
  raise ArgumentError, 'min_numeric must be greater than or equal to 0' if min_numeric&.negative?
42
57
 
43
- if min_alpha.zero? && min_numeric.zero?
44
- return Array.new(char_count) { sample(ALPHANUMS) }.join
45
- end
58
+ return Array.new(char_count) { sample(ALPHANUMS) }.join if min_alpha.zero? && min_numeric.zero?
46
59
 
47
- if min_alpha + min_numeric > char_count
48
- raise ArgumentError, 'min_alpha + min_numeric must be <= number'
49
- end
60
+ raise ArgumentError, 'min_alpha + min_numeric must be <= number' if min_alpha + min_numeric > char_count
50
61
 
51
62
  random_count = char_count - min_alpha - min_numeric
52
63
 
@@ -3,32 +3,71 @@
3
3
  module Faker
4
4
  class App < Base
5
5
  class << self
6
+ ##
7
+ # Produces an app name.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::App.name #=> "Treeflex"
13
+ #
14
+ # @faker.version 1.4.3
6
15
  def name
7
16
  fetch('app.name')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces a version string.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::App.version #=> "1.85"
26
+ #
27
+ # @faker.version 1.4.3
10
28
  def version
11
29
  parse('app.version')
12
30
  end
13
31
 
32
+ ##
33
+ # Produces the name of an app's author.
34
+ #
35
+ # @return [String]
36
+ #
37
+ # @example
38
+ # Faker::App.author #=> "Daphne Swift"
39
+ #
40
+ # @faker.version 1.4.3
14
41
  def author
15
42
  parse('app.author')
16
43
  end
17
44
 
18
45
  # rubocop:disable Metrics/ParameterLists
46
+
47
+ ##
48
+ # Produces a String representing a semantic version identifier.
49
+ #
50
+ # @param major [Integer, Range] An integer to use or a range to pick the integer from.
51
+ # @param minor [Integer, Range] An integer to use or a range to pick the integer from.
52
+ # @param patch [Integer, Range] An integer to use or a range to pick the integer from.
53
+ # @return [String]
54
+ #
55
+ # @example
56
+ # Faker::App.semantic_version #=> "3.2.5"
57
+ # @example
58
+ # Faker::App.semantic_version(major: 42) #=> "42.5.2"
59
+ # @example
60
+ # Faker::App.semantic_version(minor: 100..101) #=> "42.100.4"
61
+ # @example
62
+ # Faker::App.semantic_version(patch: 5..6) #=> "7.2.6"
63
+ #
64
+ # @faker.version 1.4.3
19
65
  def semantic_version(legacy_major = NOT_GIVEN, legacy_minor = NOT_GIVEN, legacy_patch = NOT_GIVEN, major: 0..9, minor: 0..9, patch: 1..9)
20
66
  # rubocop:enable Metrics/ParameterLists
21
- if legacy_major != NOT_GIVEN
22
- warn_with_uplevel 'Passing `major` with the 1st argument of `App.semantic_version` is deprecated. Use keyword argument like `App.semantic_version(major: ...)` instead.', uplevel: 1
23
- major = legacy_major
24
- end
25
- if legacy_minor != NOT_GIVEN
26
- warn_with_uplevel 'Passing `minor` with the 2nd argument of `App.semantic_version` is deprecated. Use keyword argument like `App.semantic_version(minor: ...)` instead.', uplevel: 1
27
- minor = legacy_minor
28
- end
29
- if legacy_patch != NOT_GIVEN
30
- warn_with_uplevel 'Passing `patch` with the 3rd argument of `App.semantic_version` is deprecated. Use keyword argument like `App.semantic_version(patch: ...)` instead.', uplevel: 1
31
- patch = legacy_patch
67
+ warn_for_deprecated_arguments do |keywords|
68
+ keywords << :major if legacy_major != NOT_GIVEN
69
+ keywords << :minor if legacy_minor != NOT_GIVEN
70
+ keywords << :patch if legacy_patch != NOT_GIVEN
32
71
  end
33
72
 
34
73
  [major, minor, patch].map { |chunk| sample(Array(chunk)) }.join('.')
@@ -3,10 +3,28 @@
3
3
  module Faker
4
4
  class Appliance < Base
5
5
  class << self
6
+ ##
7
+ # Produces the name of an appliance brand.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::Appliance.brand #=> "Bosch"
13
+ #
14
+ # @faker.version 1.9.0
6
15
  def brand
7
16
  fetch('appliance.brand')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces the name of a type of appliance equipment.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::Appliance.equipment #=> "Appliance plug"
26
+ #
27
+ # @faker.version 1.9.0
10
28
  def equipment
11
29
  fetch('appliance.equipment')
12
30
  end
@@ -3,6 +3,15 @@
3
3
  module Faker
4
4
  class Artist < Base
5
5
  class << self
6
+ ##
7
+ # Produces the name of an artist.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::Artist.name #=> "Michelangelo"
13
+ #
14
+ # @faker.version 1.8.8
6
15
  def name
7
16
  fetch('artist.names')
8
17
  end