faker 2.1.2 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +88 -7
  3. data/README.md +2 -3
  4. data/lib/faker.rb +56 -1
  5. data/lib/faker/blockchain/bitcoin.rb +26 -0
  6. data/lib/faker/blockchain/ethereum.rb +10 -0
  7. data/lib/faker/blockchain/tezos.rb +62 -6
  8. data/lib/faker/books/book.rb +36 -0
  9. data/lib/faker/books/culture_series.rb +49 -0
  10. data/lib/faker/books/dune.rb +66 -5
  11. data/lib/faker/books/lovecraft.rb +210 -7
  12. data/lib/faker/creature/animal.rb +9 -0
  13. data/lib/faker/creature/cat.rb +27 -0
  14. data/lib/faker/creature/dog.rb +72 -0
  15. data/lib/faker/creature/horse.rb +18 -0
  16. data/lib/faker/default/address.rb +25 -5
  17. data/lib/faker/default/alphanumeric.rb +56 -7
  18. data/lib/faker/default/app.rb +54 -1
  19. data/lib/faker/default/artist.rb +9 -0
  20. data/lib/faker/default/avatar.rb +42 -1
  21. data/lib/faker/default/bank.rb +10 -2
  22. data/lib/faker/default/boolean.rb +16 -1
  23. data/lib/faker/default/chile_rut.rb +12 -2
  24. data/lib/faker/default/code.rb +16 -3
  25. data/lib/faker/default/commerce.rb +17 -3
  26. data/lib/faker/default/company.rb +10 -2
  27. data/lib/faker/default/crypto_coin.rb +15 -3
  28. data/lib/faker/default/date.rb +37 -5
  29. data/lib/faker/default/demographic.rb +5 -1
  30. data/lib/faker/default/driving_licence.rb +10 -4
  31. data/lib/faker/default/file.rb +19 -2
  32. data/lib/faker/default/fillmurray.rb +9 -1
  33. data/lib/faker/default/finance.rb +5 -1
  34. data/lib/faker/default/gender.rb +18 -0
  35. data/lib/faker/default/hacker.rb +59 -1
  36. data/lib/faker/default/hipster.rb +45 -6
  37. data/lib/faker/default/house.rb +18 -0
  38. data/lib/faker/default/id_number.rb +11 -3
  39. data/lib/faker/default/internet.rb +94 -13
  40. data/lib/faker/default/invoice.rb +16 -3
  41. data/lib/faker/default/json.rb +19 -2
  42. data/lib/faker/default/lorem.rb +81 -10
  43. data/lib/faker/default/lorem_flickr.rb +38 -5
  44. data/lib/faker/default/lorem_pixel.rb +10 -1
  45. data/lib/faker/default/markdown.rb +6 -1
  46. data/lib/faker/default/measurement.rb +40 -8
  47. data/lib/faker/default/name.rb +5 -1
  48. data/lib/faker/default/nhs.rb +5 -1
  49. data/lib/faker/default/number.rb +56 -11
  50. data/lib/faker/default/omniauth.rb +92 -9
  51. data/lib/faker/default/phone_number.rb +5 -1
  52. data/lib/faker/default/placeholdit.rb +11 -1
  53. data/lib/faker/default/programming_language.rb +18 -0
  54. data/lib/faker/default/relationship.rb +5 -1
  55. data/lib/faker/default/source.rb +59 -3
  56. data/lib/faker/default/string.rb +5 -1
  57. data/lib/faker/default/stripe.rb +20 -4
  58. data/lib/faker/default/time.rb +37 -4
  59. data/lib/faker/default/twitter.rb +32 -18
  60. data/lib/faker/default/types.rb +27 -5
  61. data/lib/faker/default/vehicle.rb +17 -4
  62. data/lib/faker/default/world_cup.rb +11 -2
  63. data/lib/faker/games/dota.rb +5 -1
  64. data/lib/faker/games/elder_scrolls.rb +72 -0
  65. data/lib/faker/games/fallout.rb +37 -0
  66. data/lib/faker/games/game.rb +27 -0
  67. data/lib/faker/games/half_life.rb +27 -0
  68. data/lib/faker/games/overwatch.rb +27 -0
  69. data/lib/faker/games/super_smash_bros.rb +18 -0
  70. data/lib/faker/games/zelda.rb +36 -0
  71. data/lib/faker/movies/star_wars.rb +6 -4
  72. data/lib/faker/tv_shows/breaking_bad.rb +18 -0
  73. data/lib/faker/version.rb +1 -1
  74. data/lib/locales/en-CA.yml +1 -1
  75. data/lib/locales/en/science.yml +1 -1
  76. data/lib/locales/ja.yml +1 -1
  77. metadata +31 -15
@@ -9,7 +9,7 @@ module Faker
9
9
  VIN_LETTERS = 'ABCDEFGHJKLMNPRSTUVWXYZ'
10
10
  VIN_MAP = '0123456789X'
11
11
  VIN_WEIGHTS = '8765432X098765432'
12
- VIN_REGEX = /^[A-Z0-9]{3}[A-Z0-9]{5}[A-Z0-9]{1}[A-Z0-9]{1}[A-Z0-0]{1}[A-Z0-9]{1}\d{5}$/
12
+ VIN_REGEX = /^[A-Z0-9]{3}[A-Z0-9]{5}[A-Z0-9]{1}[A-Z0-9]{1}[A-Z0-0]{1}[A-Z0-9]{1}\d{5}$/.freeze
13
13
  SG_CHECKSUM_WEIGHTS = [3, 14, 2, 12, 2, 11, 1].freeze
14
14
  SG_CHECKSUM_CHARS = 'AYUSPLJGDBZXTRMKHEC'
15
15
 
@@ -26,7 +26,11 @@ module Faker
26
26
  fetch('vehicle.makes')
27
27
  end
28
28
 
29
- def model(make_of_model: '')
29
+ def model(legacy_make_of_model = NOT_GIVEN, make_of_model: '')
30
+ warn_for_deprecated_arguments do |keywords|
31
+ keywords << :make_of_model if legacy_make_of_model != NOT_GIVEN
32
+ end
33
+
30
34
  return fetch("vehicle.models_by_make.#{make}") if make_of_model.empty?
31
35
 
32
36
  fetch("vehicle.models_by_make.#{make_of_model}")
@@ -85,13 +89,22 @@ module Faker
85
89
  Faker::Time.backward(days: rand_in_range(365, 5475), period: :all, format: '%Y').to_i
86
90
  end
87
91
 
88
- def mileage(min: MILEAGE_MIN, max: MILEAGE_MAX)
92
+ def mileage(legacy_min = NOT_GIVEN, legacy_max = NOT_GIVEN, min: MILEAGE_MIN, max: MILEAGE_MAX)
93
+ warn_for_deprecated_arguments do |keywords|
94
+ keywords << :min if legacy_min != NOT_GIVEN
95
+ keywords << :max if legacy_max != NOT_GIVEN
96
+ end
97
+
89
98
  rand_in_range(min, max)
90
99
  end
91
100
 
92
101
  alias kilometrage mileage
93
102
 
94
- def license_plate(state_abreviation: '')
103
+ def license_plate(legacy_state_abreviation = NOT_GIVEN, state_abreviation: '')
104
+ warn_for_deprecated_arguments do |keywords|
105
+ keywords << :state_abreviation if legacy_state_abreviation != NOT_GIVEN
106
+ end
107
+
95
108
  return regexify(bothify(fetch('vehicle.license_plate'))) if state_abreviation.empty?
96
109
 
97
110
  key = 'vehicle.license_plate_by_state.' + state_abreviation
@@ -15,11 +15,20 @@ module Faker
15
15
  fetch('world_cup.stadiums')
16
16
  end
17
17
 
18
- def group(group: 'group_A')
18
+ def group(legacy_group = NOT_GIVEN, group: 'group_A')
19
+ warn_for_deprecated_arguments do |keywords|
20
+ keywords << :group if legacy_group != NOT_GIVEN
21
+ end
22
+
19
23
  fetch("world_cup.groups.#{group}")
20
24
  end
21
25
 
22
- def roster(country: 'Egypt', type: 'coach')
26
+ def roster(legacy_country = NOT_GIVEN, legacy_type = NOT_GIVEN, country: 'Egypt', type: 'coach')
27
+ warn_for_deprecated_arguments do |keywords|
28
+ keywords << :country if legacy_country != NOT_GIVEN
29
+ keywords << :type if legacy_type != NOT_GIVEN
30
+ end
31
+
23
32
  fetch("world_cup.rosters.#{country}.#{type}")
24
33
  end
25
34
  end
@@ -20,7 +20,11 @@ module Faker
20
20
  fetch('games.dota.player')
21
21
  end
22
22
 
23
- def quote(hero: 'abaddon')
23
+ def quote(legacy_hero = NOT_GIVEN, hero: 'abaddon')
24
+ warn_for_deprecated_arguments do |keywords|
25
+ keywords << :hero if legacy_hero != NOT_GIVEN
26
+ end
27
+
24
28
  fetch("games.dota.#{hero}.quote")
25
29
  end
26
30
  end
@@ -4,34 +4,106 @@ module Faker
4
4
  class Games
5
5
  class ElderScrolls < Base
6
6
  class << self
7
+ ##
8
+ # Produces the name of a race from the Elder Scrolls universe.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Games::ElderScrolls.race #=> "Argonian"
14
+ #
15
+ # @faker.version 1.9.2
7
16
  def race
8
17
  fetch('games.elder_scrolls.race')
9
18
  end
10
19
 
20
+ ##
21
+ # Produces the name of a city from the Elder Scrolls universe.
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Games::ElderScrolls.city #=> "Whiterun"
27
+ #
28
+ # @faker.version 1.9.2
11
29
  def city
12
30
  fetch('games.elder_scrolls.city')
13
31
  end
14
32
 
33
+ ##
34
+ # Produces the name of a creature from the Elder Scrolls universe.
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Games::ElderScrolls.creature #=> "Frost Troll"
40
+ #
41
+ # @faker.version 1.9.2
15
42
  def creature
16
43
  fetch('games.elder_scrolls.creature')
17
44
  end
18
45
 
46
+ ##
47
+ # Produces the name of a region from the Elder Scrolls universe.
48
+ #
49
+ # @return [String]
50
+ #
51
+ # @example
52
+ # Faker::Games::ElderScrolls.region #=> "Cyrodiil"
53
+ #
54
+ # @faker.version 1.9.2
19
55
  def region
20
56
  fetch('games.elder_scrolls.region')
21
57
  end
22
58
 
59
+ ##
60
+ # Produces the name of a dragon from the Elder Scrolls universe.
61
+ #
62
+ # @return [String]
63
+ #
64
+ # @example
65
+ # Faker::Games::ElderScrolls.dragon #=> "Blood Dragon"
66
+ #
67
+ # @faker.version 1.9.2
23
68
  def dragon
24
69
  fetch('games.elder_scrolls.dragon')
25
70
  end
26
71
 
72
+ ##
73
+ # Produces a randomly generated name from the Elder Scrolls universe.
74
+ #
75
+ # @return [String]
76
+ #
77
+ # @example
78
+ # Faker::Games::ElderScrolls.name #=> "Balgruuf The Old"
79
+ #
80
+ # @faker.version 1.9.2
27
81
  def name
28
82
  "#{fetch('games.elder_scrolls.first_name')} #{fetch('games.elder_scrolls.last_name')}"
29
83
  end
30
84
 
85
+ ##
86
+ # Produces a first name from the Elder Scrolls universe.
87
+ #
88
+ # @return [String]
89
+ #
90
+ # @example
91
+ # Faker::Games::ElderScrolls.first_name #=> "Balgruuf"
92
+ #
93
+ # @faker.version 1.9.2
31
94
  def first_name
32
95
  fetch('games.elder_scrolls.first_name')
33
96
  end
34
97
 
98
+ ##
99
+ # Produces a last name from the Elder Scrolls universe.
100
+ #
101
+ # @return [String]
102
+ #
103
+ # @example
104
+ # Faker::Games::ElderScrolls.last_name #=> "The Old"
105
+ #
106
+ # @faker.version 1.9.2
35
107
  def last_name
36
108
  fetch('games.elder_scrolls.last_name')
37
109
  end
@@ -4,18 +4,55 @@ module Faker
4
4
  class Games
5
5
  class Fallout < Base
6
6
  class << self
7
+ ##
8
+ # Produces the name of a character from the Fallout games.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Games::Fallout.character #=> "Liberty Prime"
14
+ #
15
+ # @faker.version 1.9.2
7
16
  def character
8
17
  fetch('games.fallout.characters')
9
18
  end
10
19
 
20
+ ##
21
+ # Produces the name of a faction from the Fallout games.
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Games::Fallout.faction #=> "Brotherhood of Steel"
27
+ #
28
+ # @faker.version 1.9.2
11
29
  def faction
12
30
  fetch('games.fallout.factions')
13
31
  end
14
32
 
33
+ ##
34
+ # Produces the name of a location from the Fallout games.
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Games::Fallout.location #=> "New Vegas"
40
+ #
41
+ # @faker.version 1.9.2
15
42
  def location
16
43
  fetch('games.fallout.locations')
17
44
  end
18
45
 
46
+ ##
47
+ # Produces a quote from the Fallout games.
48
+ #
49
+ # @return [String]
50
+ #
51
+ # @example
52
+ # Faker::Games::Fallout.quote
53
+ # #=> "Democracy is non-negotiable"
54
+ #
55
+ # @faker.version 1.9.2
19
56
  def quote
20
57
  fetch('games.fallout.quotes')
21
58
  end
@@ -5,14 +5,41 @@ module Faker
5
5
  flexible :game
6
6
 
7
7
  class << self
8
+ ##
9
+ # Produces the name of a video game.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Game.title #=> "Half-Life 2"
15
+ #
16
+ # @faker.version 1.9.4
8
17
  def title
9
18
  fetch('game.title')
10
19
  end
11
20
 
21
+ ##
22
+ # Produces the name of a video game genre.
23
+ #
24
+ # @return [String]
25
+ #
26
+ # @example
27
+ # Faker::Game.genre #=> "Real-time strategy"
28
+ #
29
+ # @faker.version 1.9.4
12
30
  def genre
13
31
  fetch('game.genre')
14
32
  end
15
33
 
34
+ ##
35
+ # Produces the name of a video game console or platform.
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example
40
+ # Faker::Game.platform #=> "Nintendo Switch"
41
+ #
42
+ # @faker.version 1.9.4
16
43
  def platform
17
44
  fetch('game.platform')
18
45
  end
@@ -4,14 +4,41 @@ module Faker
4
4
  class Games
5
5
  class HalfLife < Base
6
6
  class << self
7
+ ##
8
+ # Produces the name of a character from the Half-Life games.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Games::HalfLife.character #=> "Gordon Freeman"
14
+ #
15
+ # @faker.version 1.9.2
7
16
  def character
8
17
  fetch('games.half_life.character')
9
18
  end
10
19
 
20
+ ##
21
+ # Produces the name of an enemy from the Half-Life games.
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Games::HalfLife.enemy #=> "Headcrab"
27
+ #
28
+ # @faker.version 1.9.2
11
29
  def enemy
12
30
  fetch('games.half_life.enemy')
13
31
  end
14
32
 
33
+ ##
34
+ # Produces the name of a location from the Half-Life games.
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Games::HalfLife.location #=> "Black Mesa Research Facility"
40
+ #
41
+ # @faker.version 1.9.2
15
42
  def location
16
43
  fetch('games.half_life.location')
17
44
  end
@@ -4,14 +4,41 @@ module Faker
4
4
  class Games
5
5
  class Overwatch < Base
6
6
  class << self
7
+ ##
8
+ # Produces the name of a hero from Overwatch.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Games::Overwatch.hero #=> "Tracer"
14
+ #
15
+ # @faker.version 1.8.0
7
16
  def hero
8
17
  fetch('games.overwatch.heroes')
9
18
  end
10
19
 
20
+ ##
21
+ # Produces the name of a location from Overwatch.
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Games::Overwatch.location #=> "Numbani"
27
+ #
28
+ # @faker.version 1.8.0
11
29
  def location
12
30
  fetch('games.overwatch.locations')
13
31
  end
14
32
 
33
+ ##
34
+ # Produces a quote from Overwatch.
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Games::Overwatch.quote #=> "It's high noon"
40
+ #
41
+ # @faker.version 1.8.0
15
42
  def quote
16
43
  fetch('games.overwatch.quotes')
17
44
  end
@@ -4,10 +4,28 @@ module Faker
4
4
  class Games
5
5
  class SuperSmashBros < Base
6
6
  class << self
7
+ ##
8
+ # Produces the name of a fighter from the Smash Bros games.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Games::SuperSmashBros.fighter #=> "Mario"
14
+ #
15
+ # @faker.version 1.9.2
7
16
  def fighter
8
17
  fetch('games.super_smash_bros.fighter')
9
18
  end
10
19
 
20
+ ##
21
+ # Produces the name of a stage from the Smash Bros games.
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Games::SuperSmashBros.stage #=> "Final Destination"
27
+ #
28
+ # @faker.version 1.9.2
11
29
  def stage
12
30
  fetch('games.super_smash_bros.stage')
13
31
  end
@@ -5,18 +5,54 @@ module Faker
5
5
  class Zelda < Base
6
6
  flexible :space
7
7
  class << self
8
+ ##
9
+ # Produces the name of a Legend of Zelda game.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Games::Zelda.game #=> "Breath of the Wild"
15
+ #
16
+ # @faker.version 1.7.3
8
17
  def game
9
18
  fetch('games.zelda.games')
10
19
  end
11
20
 
21
+ ##
22
+ # Produces the name of a character from the Legend of Zelda games.
23
+ #
24
+ # @return [String]
25
+ #
26
+ # @example
27
+ # Faker::Games::Zelda.character #=> "Link"
28
+ #
29
+ # @faker.version 1.7.3
12
30
  def character
13
31
  fetch('games.zelda.characters')
14
32
  end
15
33
 
34
+ ##
35
+ # Produces the name of a character from the Legend of Zelda games.
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example
40
+ # Faker::Games::Zelda.location #=> "Hyrule Castle"
41
+ #
42
+ # @faker.version 1.7.3
16
43
  def location
17
44
  fetch('games.zelda.locations')
18
45
  end
19
46
 
47
+ ##
48
+ # Produces the name of an item from the Legend of Zelda games.
49
+ #
50
+ # @return [String]
51
+ #
52
+ # @example
53
+ # Faker::Games::Zelda.item #=> "Boomerang"
54
+ #
55
+ # @faker.version 1.7.3
20
56
  def item
21
57
  fetch('games.zelda.items')
22
58
  end