faker 2.4.0 → 2.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +159 -0
  3. data/README.md +3 -0
  4. data/lib/faker/default/address.rb +202 -0
  5. data/lib/faker/default/ancient.rb +36 -0
  6. data/lib/faker/default/app.rb +2 -1
  7. data/lib/faker/default/avatar.rb +2 -1
  8. data/lib/faker/default/bank.rb +13 -7
  9. data/lib/faker/default/bossa_nova.rb +18 -0
  10. data/lib/faker/default/business.rb +27 -0
  11. data/lib/faker/default/chuck_norris.rb +12 -2
  12. data/lib/faker/default/coffee.rb +45 -0
  13. data/lib/faker/default/coin.rb +18 -0
  14. data/lib/faker/default/color.rb +48 -1
  15. data/lib/faker/default/crypto.rb +27 -0
  16. data/lib/faker/default/currency.rb +27 -0
  17. data/lib/faker/default/date.rb +83 -2
  18. data/lib/faker/default/demographic.rb +57 -0
  19. data/lib/faker/default/driving_licence.rb +2 -2
  20. data/lib/faker/default/educator.rb +60 -6
  21. data/lib/faker/default/esport.rb +45 -0
  22. data/lib/faker/default/fillmurray.rb +23 -1
  23. data/lib/faker/default/food.rb +65 -1
  24. data/lib/faker/default/id_number.rb +29 -0
  25. data/lib/faker/default/internet.rb +21 -8
  26. data/lib/faker/default/kpop.rb +54 -0
  27. data/lib/faker/default/nation.rb +48 -5
  28. data/lib/faker/default/number.rb +124 -0
  29. data/lib/faker/default/relationship.rb +45 -0
  30. data/lib/faker/default/restaurant.rb +54 -2
  31. data/lib/faker/default/space.rb +127 -0
  32. data/lib/faker/default/team.rb +45 -0
  33. data/lib/faker/default/time.rb +85 -8
  34. data/lib/faker/default/world_cup.rb +50 -0
  35. data/lib/faker/games/zelda.rb +1 -1
  36. data/lib/faker/japanese_media/one_piece.rb +54 -0
  37. data/lib/faker/movies/back_to_the_future.rb +28 -0
  38. data/lib/faker/movies/ghostbusters.rb +28 -0
  39. data/lib/faker/movies/harry_potter.rb +54 -0
  40. data/lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb +69 -0
  41. data/lib/faker/movies/lebowski.rb +27 -0
  42. data/lib/faker/movies/lord_of_the_rings.rb +28 -0
  43. data/lib/faker/movies/princess_bride.rb +19 -0
  44. data/lib/faker/movies/star_wars.rb +94 -0
  45. data/lib/faker/movies/v_for_vendetta.rb +29 -0
  46. data/lib/faker/music/umphreys_mcgee.rb +9 -0
  47. data/lib/faker/sports/basketball.rb +36 -0
  48. data/lib/faker/sports/football.rb +45 -0
  49. data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +9 -0
  50. data/lib/faker/tv_shows/bojack_horseman.rb +28 -0
  51. data/lib/faker/tv_shows/buffy.rb +45 -0
  52. data/lib/faker/tv_shows/community.rb +19 -0
  53. data/lib/faker/tv_shows/dr_who.rb +78 -2
  54. data/lib/faker/tv_shows/dumb_and_dumber.rb +28 -0
  55. data/lib/faker/tv_shows/family_guy.rb +28 -0
  56. data/lib/faker/tv_shows/friends.rb +27 -0
  57. data/lib/faker/tv_shows/game_of_thrones.rb +46 -0
  58. data/lib/faker/tv_shows/hey_arnold.rb +27 -0
  59. data/lib/faker/tv_shows/how_i_met_your_mother.rb +37 -0
  60. data/lib/faker/tv_shows/michael_scott.rb +13 -0
  61. data/lib/faker/tv_shows/new_girl.rb +19 -0
  62. data/lib/faker/tv_shows/parks_and_rec.rb +18 -0
  63. data/lib/faker/tv_shows/rick_and_morty.rb +28 -0
  64. data/lib/faker/tv_shows/ru_paul.rb +18 -0
  65. data/lib/faker/tv_shows/seinfeld.rb +28 -0
  66. data/lib/faker/tv_shows/silicon_valley.rb +75 -0
  67. data/lib/faker/tv_shows/simpsons.rb +28 -0
  68. data/lib/faker/tv_shows/south_park.rb +19 -0
  69. data/lib/faker/tv_shows/star_trek.rb +36 -0
  70. data/lib/faker/tv_shows/stargate.rb +28 -0
  71. data/lib/faker/tv_shows/stranger_things.rb +19 -0
  72. data/lib/faker/tv_shows/the_expanse.rb +36 -0
  73. data/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb +28 -0
  74. data/lib/faker/tv_shows/the_it_crowd.rb +37 -0
  75. data/lib/faker/tv_shows/the_thick_of_it.rb +28 -0
  76. data/lib/faker/tv_shows/twin_peaks.rb +28 -0
  77. data/lib/faker/tv_shows/venture_bros.rb +38 -0
  78. data/lib/faker/version.rb +1 -1
  79. data/lib/locales/en-CA.yml +1 -0
  80. data/lib/locales/en-TH.yml +360 -0
  81. data/lib/locales/en/color.yml +1 -1
  82. data/lib/locales/en/dr_who.yml +1 -1
  83. data/lib/locales/en/educator.yml +69 -6
  84. data/lib/locales/en/overwatch.yml +2617 -32
  85. data/lib/locales/en/super_smash_bros.yml +1 -0
  86. data/lib/locales/fr-CA.yml +1 -1
  87. data/lib/locales/ja.yml +6 -2
  88. data/lib/locales/pt-BR.yml +23 -2
  89. data/lib/locales/th.yml +380 -0
  90. metadata +22 -14
@@ -5,6 +5,15 @@ module Faker
5
5
  flexible :relationship
6
6
 
7
7
  class << self
8
+ ##
9
+ # Produces a random family relationship.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Relationship.familial #=> "Grandfather"
15
+ #
16
+ # @faker.version 1.9.2
8
17
  def familial(legacy_connection = NOT_GIVEN, connection: nil)
9
18
  warn_for_deprecated_arguments do |keywords|
10
19
  keywords << :connection if legacy_connection != NOT_GIVEN
@@ -26,18 +35,54 @@ module Faker
26
35
  fetch('relationship.familial.' + connection)
27
36
  end
28
37
 
38
+ ##
39
+ # Produces a random in-law relationship.
40
+ #
41
+ # @return [String]
42
+ #
43
+ # @example
44
+ # Faker::Relationship.in_law #=> "Brother-in-law"
45
+ #
46
+ # @faker.version 1.9.2
29
47
  def in_law
30
48
  fetch('relationship.in_law')
31
49
  end
32
50
 
51
+ ##
52
+ # Produces a random spouse relationship.
53
+ #
54
+ # @return [String]
55
+ #
56
+ # @example
57
+ # Faker::Relationship.spouse #=> "Husband"
58
+ #
59
+ # @faker.version 1.9.2
33
60
  def spouse
34
61
  fetch('relationship.spouse')
35
62
  end
36
63
 
64
+ ##
65
+ # Produces a random parent relationship.
66
+ #
67
+ # @return [String]
68
+ #
69
+ # @example
70
+ # Faker::Relationship.parent #=> "Father"
71
+ #
72
+ # @faker.version 1.9.2
37
73
  def parent
38
74
  fetch('relationship.parent')
39
75
  end
40
76
 
77
+ ##
78
+ # Produces a random sibling relationship.
79
+ #
80
+ # @return [String]
81
+ #
82
+ # @example
83
+ # Faker::Relationship.sibling #=> "Sister"
84
+ #
85
+ # @faker.version 1.9.2
41
86
  def sibling
42
87
  fetch('relationship.sibling')
43
88
  end
@@ -4,8 +4,60 @@ module Faker
4
4
  class Restaurant < Base
5
5
  flexible :restaurant
6
6
 
7
- def self.name
8
- bothify(parse('restaurant.name'))
7
+ class << self
8
+ ##
9
+ # Produces the name of a restaurant.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Restaurant.name #=> "Curry King"
15
+ #
16
+ # @faker.version 1.9.2
17
+ def name
18
+ bothify(parse('restaurant.name'))
19
+ end
20
+
21
+ ##
22
+ # Produces a type of restaurant.
23
+ #
24
+ # @return [String]
25
+ #
26
+ # @example
27
+ # Faker::Restaurant.type #=> "Comfort Food"
28
+ #
29
+ # @faker.version 1.9.2
30
+ def type
31
+ fetch('restaurant.type')
32
+ end
33
+
34
+ ##
35
+ # Produces a description of a restaurant.
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example
40
+ # Faker::Restaurant.description
41
+ # #=> "We are committed to using the finest ingredients in our recipes. No food leaves our kitchen that we ourselves would not eat."
42
+ #
43
+ # @faker.version 1.9.2
44
+ def description
45
+ fetch('restaurant.description')
46
+ end
47
+
48
+ ##
49
+ # Produces a review for a restaurant.
50
+ #
51
+ # @return [String]
52
+ #
53
+ # @example
54
+ # Faker::Restaurant.review
55
+ # #=> "Brand new. Great design. Odd to hear pop music in a Mexican establishment. Music is a bit loud. It should be background."
56
+ #
57
+ # @faker.version 1.9.2
58
+ def review
59
+ fetch('restaurant.review')
60
+ end
9
61
  end
10
62
  end
11
63
  end
@@ -3,59 +3,186 @@
3
3
  module Faker
4
4
  class Space < Base
5
5
  flexible :space
6
+
6
7
  class << self
8
+ ##
9
+ # Produces the name of a planet.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Space.planet #=> "Venus"
15
+ #
16
+ # @faker.version 1.6.4
7
17
  def planet
8
18
  fetch('space.planet')
9
19
  end
10
20
 
21
+ ##
22
+ # Produces the name of a moon.
23
+ #
24
+ # @return [String]
25
+ #
26
+ # @example
27
+ # Faker::Space.moon #=> "Europa"
28
+ #
29
+ # @faker.version 1.6.4
11
30
  def moon
12
31
  fetch('space.moon')
13
32
  end
14
33
 
34
+ ##
35
+ # Produces the name of a galaxy.
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example
40
+ # Faker::Space.galaxy #=> "Andromeda"
41
+ #
42
+ # @faker.version 1.6.4
15
43
  def galaxy
16
44
  fetch('space.galaxy')
17
45
  end
18
46
 
47
+ ##
48
+ # Produces the name of a nebula.
49
+ #
50
+ # @return [String]
51
+ #
52
+ # @example
53
+ # Faker::Space.nebula #=> "Triffid Nebula"
54
+ #
55
+ # @faker.version 1.6.4
19
56
  def nebula
20
57
  fetch('space.nebula')
21
58
  end
22
59
 
60
+ ##
61
+ # Produces the name of a star cluster.
62
+ #
63
+ # @return [String]
64
+ #
65
+ # @example
66
+ # Faker::Space.star_cluster #=> "Messier 70"
67
+ #
68
+ # @faker.version 1.6.4
23
69
  def star_cluster
24
70
  fetch('space.star_cluster')
25
71
  end
26
72
 
73
+ ##
74
+ # Produces the name of a constellation.
75
+ #
76
+ # @return [String]
77
+ #
78
+ # @example
79
+ # Faker::Space.constellation #=> "Orion"
80
+ #
81
+ # @faker.version 1.6.4
27
82
  def constellation
28
83
  fetch('space.constellation')
29
84
  end
30
85
 
86
+ ##
87
+ # Produces the name of a star.
88
+ #
89
+ # @return [String]
90
+ #
91
+ # @example
92
+ # Faker::Space.star #=> "Proxima Centauri"
93
+ #
94
+ # @faker.version 1.6.4
31
95
  def star
32
96
  fetch('space.star')
33
97
  end
34
98
 
99
+ ##
100
+ # Produces the name of a space agency.
101
+ #
102
+ # @return [String]
103
+ #
104
+ # @example
105
+ # Faker::Space.agency #=> "Japan Aerospace Exploration Agency"
106
+ #
107
+ # @faker.version 1.6.4
35
108
  def agency
36
109
  fetch('space.agency')
37
110
  end
38
111
 
112
+ ##
113
+ # Produces a space agency abbreviation.
114
+ #
115
+ # @return [String]
116
+ #
117
+ # @example
118
+ # Faker::Space.agency_abv #=> "NASA"
119
+ #
120
+ # @faker.version 1.6.4
39
121
  def agency_abv
40
122
  fetch('space.agency_abv')
41
123
  end
42
124
 
125
+ ##
126
+ # Produces the name of a NASA spacecraft.
127
+ #
128
+ # @return [String]
129
+ #
130
+ # @example
131
+ # Faker::Space.nasa_space_craft #=> "Endeavour"
132
+ #
133
+ # @faker.version 1.6.4
43
134
  def nasa_space_craft
44
135
  fetch('space.nasa_space_craft')
45
136
  end
46
137
 
138
+ ##
139
+ # Produces the name of a space company.
140
+ #
141
+ # @return [String]
142
+ #
143
+ # @example
144
+ # Faker::Space.company #=> "SpaceX"
145
+ #
146
+ # @faker.version 1.6.4
47
147
  def company
48
148
  fetch('space.company')
49
149
  end
50
150
 
151
+ ##
152
+ # Produces a distance measurement.
153
+ #
154
+ # @return [String]
155
+ #
156
+ # @example
157
+ # Faker::Space.distance_measurement #=> "15 parsecs"
158
+ #
159
+ # @faker.version 1.6.4
51
160
  def distance_measurement
52
161
  rand(10..100).to_s + ' ' + fetch('space.distance_measurement')
53
162
  end
54
163
 
164
+ ##
165
+ # Produces the name of a meteorite.
166
+ #
167
+ # @return [String]
168
+ #
169
+ # @example
170
+ # Faker::Space.meteorite #=> "Ensisheim"
171
+ #
172
+ # @faker.version 1.7.0
55
173
  def meteorite
56
174
  fetch('space.meteorite')
57
175
  end
58
176
 
177
+ ##
178
+ # Produces the name of a launch vehicle.
179
+ #
180
+ # @return [String]
181
+ #
182
+ # @example
183
+ # Faker::Space.launch_vehicle #=> "Saturn IV"
184
+ #
185
+ # @faker.version 1.9.0
59
186
  def launch_vehicle
60
187
  fetch('space.launch_vehicle')
61
188
  end
@@ -5,22 +5,67 @@ module Faker
5
5
  flexible :team
6
6
 
7
7
  class << self
8
+ ##
9
+ # Produces a team name from a state and a creature.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Team.name #=> "Oregon vixens"
15
+ #
16
+ # @faker.version 1.3.0
8
17
  def name
9
18
  parse('team.name')
10
19
  end
11
20
 
21
+ ##
22
+ # Produces a team creature.
23
+ #
24
+ # @return [String]
25
+ #
26
+ # @example
27
+ # Faker::Team.creature #=> "geese"
28
+ #
29
+ # @faker.version 1.3.0
12
30
  def creature
13
31
  fetch('team.creature')
14
32
  end
15
33
 
34
+ ##
35
+ # Produces a team state.
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example
40
+ # Faker::Team.state #=> "Oregon"
41
+ #
42
+ # @faker.version 1.3.0
16
43
  def state
17
44
  fetch('address.state')
18
45
  end
19
46
 
47
+ ##
48
+ # Produces a team sport.
49
+ #
50
+ # @return [String]
51
+ #
52
+ # @example
53
+ # Faker::Team.sport #=> "Lacrosse"
54
+ #
55
+ # @faker.version 1.5.0
20
56
  def sport
21
57
  fetch('team.sport')
22
58
  end
23
59
 
60
+ ##
61
+ # Produces the name of a team mascot.
62
+ #
63
+ # @return [String]
64
+ #
65
+ # @example
66
+ # Faker::Team.mascot #=> "Hugo"
67
+ #
68
+ # @faker.version 1.8.1
24
69
  def mascot
25
70
  fetch('team.mascot')
26
71
  end
@@ -14,8 +14,31 @@ module Faker
14
14
 
15
15
  class << self
16
16
  # rubocop:disable Metrics/ParameterLists
17
+ # rubocop:disable Style/AsciiComments
18
+
19
+ ##
20
+ # Produce a random time between two times.
21
+ #
22
+ # @param from [Time, Date, DateTime] The start of the usable time range.
23
+ # @param to [Time, Date, DateTime] The end of the usable time range.
24
+ # @param format [Symbol] The name of a DateTime format to use.
25
+ # @return [Time]
26
+ #
27
+ # @example
28
+ # # Random Stringified time between two times, formatted to the specified I18n format
29
+ # # (Examples are from a Rails console with rails-i18n 5.1.1 defaults loaded)
30
+ # I18n.locale = 'en-US'
31
+ # Faker::Time.between(from: DateTime.now - 1, to: DateTime.now, format: :default) #=> "Tue, 16 Oct 2018 10:48:27 AM -05:00"
32
+ # Faker::Time.between(from: DateTime.now - 1, to: DateTime.now, format: :short) #=> "15 Oct 10:48 AM"
33
+ # Faker::Time.between(from: DateTime.now - 1, to: DateTime.now, format: :long) #=> "October 15, 2018 10:48 AM"
34
+ #
35
+ # I18n.locale = 'ja'
36
+ # Faker::Time.between(from: DateTime.now - 1, to: DateTime.now, format: :default) #=> "2018/10/15 10:48:27"
37
+ # Faker::Time.between(from: DateTime.now - 1, to: DateTime.now, format: :short) #=> "18/10/15 10:48"
38
+ # Faker::Time.between(from: DateTime.now - 1, to: DateTime.now, format: :long) #=> "2018年10月16日(火) 10時48分27秒 -0500"
39
+ #
40
+ # @faker.version 1.5.0
17
41
  def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, legacy_format = NOT_GIVEN, from:, to:, format: nil)
18
- # rubocop:enable Metrics/ParameterLists
19
42
  warn_for_deprecated_arguments do |keywords|
20
43
  keywords << :from if legacy_from != NOT_GIVEN
21
44
  keywords << :to if legacy_to != NOT_GIVEN
@@ -28,10 +51,37 @@ module Faker
28
51
  time = Faker::Base.rand_in_range(from, to)
29
52
  time_with_format(time, format)
30
53
  end
31
-
32
- # rubocop:disable Metrics/ParameterLists
54
+ # rubocop:enable Style/AsciiComments
55
+
56
+ ##
57
+ # Produce a random time between two dates.
58
+ #
59
+ # @param from [Date] The start of the usable time range.
60
+ # @param to [Date] The end of the usable time range.
61
+ # @param period [Symbol] The time of day, if any. See {TIME_RANGES}.
62
+ # @param format [Symbol] The name of a DateTime format to use.
63
+ # @return [Time]
64
+ #
65
+ # @example
66
+ # Faker::Time.between_dates(from: Date.today - 1, to: Date.today, period: :all)
67
+ # #=> "2014-09-19 07:03:30 -0700"
68
+ # Faker::Time.between_dates(from: Date.today - 1, to: Date.today, period: :day)
69
+ # #=> "2014-09-18 16:28:13 -0700"
70
+ # Faker::Time.between_dates(from: Date.today - 1, to: Date.today, period: :night)
71
+ # #=> "2014-09-20 19:39:38 -0700"
72
+ # Faker::Time.between_dates(from: Date.today - 1, to: Date.today, period: :morning)
73
+ # #=> "2014-09-19 08:07:52 -0700"
74
+ # Faker::Time.between_dates(from: Date.today - 1, to: Date.today, period: :afternoon)
75
+ # #=> "2014-09-18 12:10:34 -0700"
76
+ # Faker::Time.between_dates(from: Date.today - 1, to: Date.today, period: :evening)
77
+ # #=> "2014-09-19 20:21:03 -0700"
78
+ # Faker::Time.between_dates(from: Date.today - 1, to: Date.today, period: :midnight)
79
+ # #=> "2014-09-20 00:40:14 -0700"
80
+ # Faker::Time.between_dates(from: Date.today - 5, to: Date.today + 5, period: :afternoon, format: :default)
81
+ # #=> "Fri, 19 Oct 2018 15:17:46 -0500"
82
+ #
83
+ # @faker.version 1.0.0
33
84
  def between_dates(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, legacy_period = NOT_GIVEN, legacy_format = NOT_GIVEN, from:, to:, period: :all, format: nil)
34
- # rubocop:enable Metrics/ParameterLists
35
85
  warn_for_deprecated_arguments do |keywords|
36
86
  keywords << :from if legacy_from != NOT_GIVEN
37
87
  keywords << :to if legacy_to != NOT_GIVEN
@@ -44,9 +94,22 @@ module Faker
44
94
  time_with_format(time, format)
45
95
  end
46
96
 
47
- # rubocop:disable Metrics/ParameterLists
97
+ ##
98
+ # Produce a random time in the future (up to N days).
99
+ #
100
+ # @param days [Integer] The maximum number of days to go into the future.
101
+ # @param period [Symbol] The time of day, if any. See {TIME_RANGES}.
102
+ # @param format [Symbol] The name of a DateTime format to use.
103
+ # @return [Time]
104
+ #
105
+ # @example
106
+ # Faker::Time.forward(days: 23, period: :morning)
107
+ # # => "2014-09-26 06:54:47 -0700"
108
+ # Faker::Time.forward(days: 5, period: :evening, format: :long)
109
+ # #=> "October 21, 2018 20:47"
110
+ #
111
+ # @faker.version 1.5.0
48
112
  def forward(legacy_days = NOT_GIVEN, legacy_period = NOT_GIVEN, legacy_format = NOT_GIVEN, days: 365, period: :all, format: nil)
49
- # rubocop:enable Metrics/ParameterLists
50
113
  warn_for_deprecated_arguments do |keywords|
51
114
  keywords << :days if legacy_days != NOT_GIVEN
52
115
  keywords << :period if legacy_period != NOT_GIVEN
@@ -56,9 +119,22 @@ module Faker
56
119
  time_with_format(date_with_random_time(Faker::Date.forward(days: days), period), format)
57
120
  end
58
121
 
59
- # rubocop:disable Metrics/ParameterLists
122
+ ##
123
+ # Produce a random time in the past (up to N days).
124
+ #
125
+ # @param days [Integer] The maximum number of days to go into the past.
126
+ # @param period [Symbol] The time of day, if any. See {TIME_RANGES}.
127
+ # @param format [Symbol] The name of a DateTime format to use.
128
+ # @return [Time]
129
+ #
130
+ # @example
131
+ # Faker::Time.backward(days: 14, period: :evening)
132
+ # #=> "2014-09-17 19:56:33 -0700"
133
+ # Faker::Time.backward(days: 5, period: :morning, format: :short)
134
+ # #=> "14 Oct 07:44"
135
+ #
136
+ # @faker.version 1.5.0
60
137
  def backward(legacy_days = NOT_GIVEN, legacy_period = NOT_GIVEN, legacy_format = NOT_GIVEN, days: 365, period: :all, format: nil)
61
- # rubocop:enable Metrics/ParameterLists
62
138
  warn_for_deprecated_arguments do |keywords|
63
139
  keywords << :days if legacy_days != NOT_GIVEN
64
140
  keywords << :period if legacy_period != NOT_GIVEN
@@ -67,6 +143,7 @@ module Faker
67
143
 
68
144
  time_with_format(date_with_random_time(Faker::Date.backward(days: days), period), format)
69
145
  end
146
+ # rubocop:enable Metrics/ParameterLists
70
147
 
71
148
  private
72
149