faker 2.2.2 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +135 -0
  3. data/README.md +5 -2
  4. data/lib/faker/blockchain/aeternity.rb +70 -0
  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 +56 -0
  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 +56 -3
  11. data/lib/faker/books/lovecraft.rb +172 -0
  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/alphanumeric.rb +23 -6
  17. data/lib/faker/default/app.rb +46 -0
  18. data/lib/faker/default/appliance.rb +18 -0
  19. data/lib/faker/default/artist.rb +9 -0
  20. data/lib/faker/default/avatar.rb +32 -0
  21. data/lib/faker/default/boolean.rb +12 -1
  22. data/lib/faker/default/chuck_norris.rb +1 -1
  23. data/lib/faker/default/date.rb +83 -2
  24. data/lib/faker/default/dessert.rb +27 -0
  25. data/lib/faker/default/device.rb +54 -0
  26. data/lib/faker/default/driving_licence.rb +2 -2
  27. data/lib/faker/default/electrical_components.rb +27 -0
  28. data/lib/faker/default/gender.rb +18 -0
  29. data/lib/faker/default/greek_philosophers.rb +18 -0
  30. data/lib/faker/default/hacker.rb +59 -1
  31. data/lib/faker/default/house.rb +18 -0
  32. data/lib/faker/default/id_number.rb +29 -0
  33. data/lib/faker/default/industry_segments.rb +36 -0
  34. data/lib/faker/default/internet.rb +19 -11
  35. data/lib/faker/default/lorem.rb +8 -7
  36. data/lib/faker/default/marketing.rb +9 -0
  37. data/lib/faker/default/military.rb +45 -0
  38. data/lib/faker/default/nation.rb +48 -5
  39. data/lib/faker/default/nato_phonetic_alphabet.rb +9 -0
  40. data/lib/faker/default/number.rb +124 -0
  41. data/lib/faker/default/omniauth.rb +42 -0
  42. data/lib/faker/default/programming_language.rb +18 -0
  43. data/lib/faker/default/restaurant.rb +54 -2
  44. data/lib/faker/default/science.rb +27 -0
  45. data/lib/faker/default/source.rb +43 -2
  46. data/lib/faker/default/subscription.rb +45 -0
  47. data/lib/faker/default/superhero.rb +45 -0
  48. data/lib/faker/default/time.rb +85 -8
  49. data/lib/faker/default/world_cup.rb +50 -0
  50. data/lib/faker/games/dota.rb +47 -0
  51. data/lib/faker/games/elder_scrolls.rb +72 -0
  52. data/lib/faker/games/fallout.rb +37 -0
  53. data/lib/faker/games/game.rb +27 -0
  54. data/lib/faker/games/half_life.rb +27 -0
  55. data/lib/faker/games/heroes.rb +27 -0
  56. data/lib/faker/games/heroes_of_the_storm.rb +36 -0
  57. data/lib/faker/games/league_of_legends.rb +54 -0
  58. data/lib/faker/games/myst.rb +45 -0
  59. data/lib/faker/games/overwatch.rb +27 -0
  60. data/lib/faker/games/pokemon.rb +27 -0
  61. data/lib/faker/games/sonic_the_hedgehog.rb +27 -0
  62. data/lib/faker/games/super_smash_bros.rb +18 -0
  63. data/lib/faker/games/witcher.rb +54 -0
  64. data/lib/faker/games/world_of_warcraft.rb +18 -0
  65. data/lib/faker/games/zelda.rb +37 -1
  66. data/lib/faker/japanese_media/dragon_ball.rb +9 -0
  67. data/lib/faker/japanese_media/one_piece.rb +54 -0
  68. data/lib/faker/japanese_media/sword_art_online.rb +36 -0
  69. data/lib/faker/movies/back_to_the_future.rb +28 -0
  70. data/lib/faker/movies/ghostbusters.rb +28 -0
  71. data/lib/faker/movies/harry_potter.rb +54 -0
  72. data/lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb +69 -0
  73. data/lib/faker/movies/hobbit.rb +37 -0
  74. data/lib/faker/movies/lebowski.rb +27 -0
  75. data/lib/faker/movies/lord_of_the_rings.rb +28 -0
  76. data/lib/faker/movies/movie.rb +9 -0
  77. data/lib/faker/movies/princess_bride.rb +19 -0
  78. data/lib/faker/movies/star_wars.rb +94 -0
  79. data/lib/faker/movies/v_for_vendetta.rb +29 -0
  80. data/lib/faker/music/grateful_dead.rb +18 -0
  81. data/lib/faker/music/phish.rb +9 -0
  82. data/lib/faker/music/rock_band.rb +9 -0
  83. data/lib/faker/music/umphreys_mcgee.rb +9 -0
  84. data/lib/faker/sports/basketball.rb +36 -0
  85. data/lib/faker/sports/football.rb +45 -0
  86. data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +9 -0
  87. data/lib/faker/tv_shows/bojack_horseman.rb +28 -0
  88. data/lib/faker/tv_shows/breaking_bad.rb +18 -0
  89. data/lib/faker/tv_shows/buffy.rb +45 -0
  90. data/lib/faker/tv_shows/community.rb +19 -0
  91. data/lib/faker/tv_shows/dr_who.rb +78 -2
  92. data/lib/faker/tv_shows/dumb_and_dumber.rb +28 -0
  93. data/lib/faker/tv_shows/family_guy.rb +28 -0
  94. data/lib/faker/tv_shows/friends.rb +27 -0
  95. data/lib/faker/tv_shows/game_of_thrones.rb +46 -0
  96. data/lib/faker/tv_shows/hey_arnold.rb +27 -0
  97. data/lib/faker/tv_shows/how_i_met_your_mother.rb +37 -0
  98. data/lib/faker/tv_shows/michael_scott.rb +13 -0
  99. data/lib/faker/tv_shows/new_girl.rb +19 -0
  100. data/lib/faker/tv_shows/parks_and_rec.rb +18 -0
  101. data/lib/faker/tv_shows/rick_and_morty.rb +28 -0
  102. data/lib/faker/tv_shows/ru_paul.rb +18 -0
  103. data/lib/faker/tv_shows/seinfeld.rb +28 -0
  104. data/lib/faker/tv_shows/silicon_valley.rb +75 -0
  105. data/lib/faker/tv_shows/simpsons.rb +28 -0
  106. data/lib/faker/tv_shows/south_park.rb +19 -0
  107. data/lib/faker/tv_shows/star_trek.rb +36 -0
  108. data/lib/faker/tv_shows/stargate.rb +28 -0
  109. data/lib/faker/tv_shows/stranger_things.rb +19 -0
  110. data/lib/faker/tv_shows/the_expanse.rb +36 -0
  111. data/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb +28 -0
  112. data/lib/faker/tv_shows/the_it_crowd.rb +37 -0
  113. data/lib/faker/tv_shows/the_thick_of_it.rb +28 -0
  114. data/lib/faker/tv_shows/twin_peaks.rb +28 -0
  115. data/lib/faker/tv_shows/venture_bros.rb +38 -0
  116. data/lib/faker/version.rb +1 -1
  117. data/lib/locales/en-CA.yml +2 -1
  118. data/lib/locales/en-TH.yml +360 -0
  119. data/lib/locales/en/color.yml +1 -1
  120. data/lib/locales/en/dr_who.yml +1 -1
  121. data/lib/locales/en/science.yml +1 -1
  122. data/lib/locales/en/super_smash_bros.yml +1 -0
  123. data/lib/locales/fr-CA.yml +1 -1
  124. data/lib/locales/ja.yml +12 -9
  125. data/lib/locales/th.yml +380 -0
  126. metadata +41 -16
@@ -5,14 +5,41 @@ module Faker
5
5
  flexible :dessert
6
6
 
7
7
  class << self
8
+ ##
9
+ # Produces the name of a dessert variety.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Dessert.variety #=> "Cake"
15
+ #
16
+ # @faker.version 1.8.0
8
17
  def variety
9
18
  fetch('dessert.variety')
10
19
  end
11
20
 
21
+ ##
22
+ # Produces the name of a dessert topping.
23
+ #
24
+ # @return [String]
25
+ #
26
+ # @example
27
+ # Faker::Dessert.topping #=> "Gummy Bears"
28
+ #
29
+ # @faker.version 1.8.0
12
30
  def topping
13
31
  fetch('dessert.topping')
14
32
  end
15
33
 
34
+ ##
35
+ # Produces the name of a dessert flavor.
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example
40
+ # Faker::Dessert.flavor #=> "Salted Caramel"
41
+ #
42
+ # @faker.version 1.8.0
16
43
  def flavor
17
44
  fetch('dessert.flavor')
18
45
  end
@@ -3,26 +3,80 @@
3
3
  module Faker
4
4
  class Device < Base
5
5
  class << self
6
+ ##
7
+ # Produces a build number between 1 and 500.
8
+ #
9
+ # @return [Integer]
10
+ #
11
+ # @example
12
+ # Faker::Device.build_number #=> 5
13
+ #
14
+ # @faker.version 1.9.0
6
15
  def build_number
7
16
  Faker::Number.between(from: 1, to: 500)
8
17
  end
9
18
 
19
+ ##
20
+ # Produces the name of a manufacturer for a device.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::Device.manufacturer #=> "Apple"
26
+ #
27
+ # @faker.version 1.9.0
10
28
  def manufacturer
11
29
  fetch('device.manufacturer')
12
30
  end
13
31
 
32
+ ##
33
+ # Produces a model name for a device.
34
+ #
35
+ # @return [String]
36
+ #
37
+ # @example
38
+ # Faker::Device.model_name #=> "iPhone 4"
39
+ #
40
+ # @faker.version 1.9.0
14
41
  def model_name
15
42
  fetch('device.model_name')
16
43
  end
17
44
 
45
+ ##
46
+ # Produces the name of a platform for a device.
47
+ #
48
+ # @return [String]
49
+ #
50
+ # @example
51
+ # Faker::Device.platform #=> "webOS"
52
+ #
53
+ # @faker.version 1.9.0
18
54
  def platform
19
55
  fetch('device.platform')
20
56
  end
21
57
 
58
+ ##
59
+ # Produces a serial code for a device.
60
+ #
61
+ # @return [String]
62
+ #
63
+ # @example
64
+ # Faker::Device.serial #=> "ejfjnRNInxh0363JC2WM"
65
+ #
66
+ # @faker.version 1.9.0
22
67
  def serial
23
68
  fetch('device.serial')
24
69
  end
25
70
 
71
+ ##
72
+ # Produces a version number between 1 and 1000.
73
+ #
74
+ # @return [Integer]
75
+ #
76
+ # @example
77
+ # Faker::Device.version #=> 42
78
+ #
79
+ # @faker.version 1.9.0
26
80
  def version
27
81
  Faker::Number.between(from: 1, to: 1000)
28
82
  end
@@ -52,9 +52,9 @@ module Faker
52
52
  year = dob.year % 10
53
53
  month = gender == :female ? dob.month + 50 : dob.month
54
54
  # Rubocop's preferred formatting is pretty gory
55
- # rubocop:disable FormatString
55
+ # rubocop:disable Style/FormatString
56
56
  "#{decade}#{'%02d' % month}#{'%02d' % dob.day}#{year}"
57
- # rubocop:enable FormatString
57
+ # rubocop:enable Style/FormatString
58
58
  end
59
59
 
60
60
  def gb_licence_checksum
@@ -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,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}!",
@@ -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
@@ -16,6 +16,8 @@ module Faker
16
16
  BRAZILIAN_ID_FROM = 10_000_000
17
17
  BRAZILIAN_ID_TO = 99_999_999
18
18
 
19
+ CHILEAN_MODULO = 11
20
+
19
21
  class << self
20
22
  def valid
21
23
  _translate('valid')
@@ -105,8 +107,35 @@ module Faker
105
107
 
106
108
  alias brazilian_rg brazilian_id
107
109
 
110
+ def chilean_id
111
+ digits = Faker::Number.number(digits: 8)
112
+ verification_code = chilean_verification_code(digits)
113
+
114
+ digits.to_s + '-' + verification_code.to_s
115
+ end
116
+
108
117
  private
109
118
 
119
+ def chilean_verification_code(digits)
120
+ # First digit is multiplied by 3, second by 2, and so on
121
+ multiplication_rule = [3, 2, 7, 6, 5, 4, 3, 2]
122
+ digits_splitted = digits.to_s.chars.map(&:to_i)
123
+
124
+ sum = digits_splitted.map.with_index { |digit, index| digit * multiplication_rule[index] }.reduce(:+)
125
+
126
+ modulo = sum.modulo(CHILEAN_MODULO)
127
+ difference = CHILEAN_MODULO - modulo
128
+
129
+ case difference
130
+ when 0..9
131
+ difference
132
+ when 10
133
+ 'K'
134
+ when 11
135
+ 0
136
+ end
137
+ end
138
+
110
139
  def south_african_id_checksum_digit(id_number)
111
140
  value_parts = id_number.chars
112
141
  even_digits = value_parts
@@ -5,18 +5,54 @@ module Faker
5
5
  flexible :industry_segments
6
6
 
7
7
  class << self
8
+ ##
9
+ # Produces the name of an industry.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::IndustrySegments.industry #=> "Basic Materials"
15
+ #
16
+ # @faker.version 1.9.2
8
17
  def industry
9
18
  fetch('industry_segments.industry')
10
19
  end
11
20
 
21
+ ##
22
+ # Produces the name of a super-sector of an industry.
23
+ #
24
+ # @return [String]
25
+ #
26
+ # @example
27
+ # Faker::IndustrySegments.super_sector #=> "Basic Resources"
28
+ #
29
+ # @faker.version 1.9.2
12
30
  def super_sector
13
31
  fetch('industry_segments.super_sector')
14
32
  end
15
33
 
34
+ ##
35
+ # Produces the name of a sector of an industry.
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example
40
+ # Faker::IndustrySegments.sector #=> "Industrial Metals & Mining"
41
+ #
42
+ # @faker.version 1.9.2
16
43
  def sector
17
44
  fetch('industry_segments.sector')
18
45
  end
19
46
 
47
+ ##
48
+ # Produces the name of a subsector of an industry.
49
+ #
50
+ # @return [String]
51
+ #
52
+ # @example
53
+ # Faker::IndustrySegments.industry #=> "Basic Materials"
54
+ #
55
+ # @faker.version 1.9.2
20
56
  def sub_sector
21
57
  fetch('industry_segments.sub_sector')
22
58
  end