faker 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -0
  3. data/lib/faker/default/app.rb +2 -1
  4. data/lib/faker/default/avatar.rb +2 -1
  5. data/lib/faker/default/chuck_norris.rb +1 -1
  6. data/lib/faker/default/date.rb +59 -2
  7. data/lib/faker/default/internet.rb +4 -1
  8. data/lib/faker/default/nation.rb +48 -5
  9. data/lib/faker/default/number.rb +124 -0
  10. data/lib/faker/default/restaurant.rb +54 -2
  11. data/lib/faker/default/time.rb +85 -8
  12. data/lib/faker/games/zelda.rb +1 -1
  13. data/lib/faker/japanese_media/one_piece.rb +54 -0
  14. data/lib/faker/movies/back_to_the_future.rb +28 -0
  15. data/lib/faker/movies/ghostbusters.rb +28 -0
  16. data/lib/faker/movies/harry_potter.rb +54 -0
  17. data/lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb +69 -0
  18. data/lib/faker/movies/lebowski.rb +27 -0
  19. data/lib/faker/movies/lord_of_the_rings.rb +28 -0
  20. data/lib/faker/movies/princess_bride.rb +19 -0
  21. data/lib/faker/movies/star_wars.rb +94 -0
  22. data/lib/faker/movies/v_for_vendetta.rb +29 -0
  23. data/lib/faker/music/umphreys_mcgee.rb +9 -0
  24. data/lib/faker/sports/basketball.rb +36 -0
  25. data/lib/faker/sports/football.rb +45 -0
  26. data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +9 -0
  27. data/lib/faker/tv_shows/bojack_horseman.rb +28 -0
  28. data/lib/faker/tv_shows/buffy.rb +45 -0
  29. data/lib/faker/tv_shows/community.rb +19 -0
  30. data/lib/faker/tv_shows/dr_who.rb +78 -2
  31. data/lib/faker/tv_shows/dumb_and_dumber.rb +28 -0
  32. data/lib/faker/tv_shows/family_guy.rb +28 -0
  33. data/lib/faker/tv_shows/friends.rb +27 -0
  34. data/lib/faker/tv_shows/game_of_thrones.rb +46 -0
  35. data/lib/faker/tv_shows/hey_arnold.rb +27 -0
  36. data/lib/faker/tv_shows/how_i_met_your_mother.rb +37 -0
  37. data/lib/faker/tv_shows/michael_scott.rb +13 -0
  38. data/lib/faker/tv_shows/new_girl.rb +19 -0
  39. data/lib/faker/tv_shows/parks_and_rec.rb +18 -0
  40. data/lib/faker/tv_shows/rick_and_morty.rb +28 -0
  41. data/lib/faker/tv_shows/ru_paul.rb +18 -0
  42. data/lib/faker/tv_shows/seinfeld.rb +28 -0
  43. data/lib/faker/tv_shows/silicon_valley.rb +75 -0
  44. data/lib/faker/tv_shows/simpsons.rb +28 -0
  45. data/lib/faker/tv_shows/south_park.rb +19 -0
  46. data/lib/faker/tv_shows/star_trek.rb +36 -0
  47. data/lib/faker/tv_shows/stargate.rb +28 -0
  48. data/lib/faker/tv_shows/stranger_things.rb +19 -0
  49. data/lib/faker/tv_shows/the_expanse.rb +36 -0
  50. data/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb +28 -0
  51. data/lib/faker/tv_shows/the_it_crowd.rb +37 -0
  52. data/lib/faker/tv_shows/the_thick_of_it.rb +28 -0
  53. data/lib/faker/tv_shows/twin_peaks.rb +28 -0
  54. data/lib/faker/tv_shows/venture_bros.rb +38 -0
  55. data/lib/faker/version.rb +1 -1
  56. data/lib/locales/en-TH.yml +360 -0
  57. data/lib/locales/en/color.yml +1 -1
  58. data/lib/locales/en/dr_who.yml +1 -1
  59. data/lib/locales/th.yml +380 -0
  60. metadata +6 -4
@@ -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
@@ -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
 
@@ -3,7 +3,7 @@
3
3
  module Faker
4
4
  class Games
5
5
  class Zelda < Base
6
- flexible :space
6
+ flexible :zelda
7
7
  class << self
8
8
  ##
9
9
  # Produces the name of a Legend of Zelda game.
@@ -4,26 +4,80 @@ module Faker
4
4
  class JapaneseMedia
5
5
  class OnePiece < Base
6
6
  class << self
7
+ ##
8
+ # Produces a character from One Piece.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::JapaneseMedia::OnePiece.character #=> "Monkey D. Luffy"
14
+ #
15
+ # @faker.version 1.8.5
7
16
  def character
8
17
  fetch('one_piece.characters')
9
18
  end
10
19
 
20
+ ##
21
+ # Produces a sea from One Piece.
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::JapaneseMedia::OnePiece.sea #=> "East Blue"
27
+ #
28
+ # @faker.version 1.8.5
11
29
  def sea
12
30
  fetch('one_piece.seas')
13
31
  end
14
32
 
33
+ ##
34
+ # Produces an island from One Piece.
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::JapaneseMedia::OnePiece.island #=> "Laftel"
40
+ #
41
+ # @faker.version 1.8.5
15
42
  def island
16
43
  fetch('one_piece.islands')
17
44
  end
18
45
 
46
+ ##
47
+ # Produces a location from One Piece.
48
+ #
49
+ # @return [String]
50
+ #
51
+ # @example
52
+ # Faker::JapaneseMedia::OnePiece.location #=> "Foosha Village"
53
+ #
54
+ # @faker.version 1.8.5
19
55
  def location
20
56
  fetch('one_piece.locations')
21
57
  end
22
58
 
59
+ ##
60
+ # Produces a quote from One Piece.
61
+ #
62
+ # @return [String]
63
+ #
64
+ # @example
65
+ # Faker::JapaneseMedia::OnePiece.quote #=> "ONE PIECE IS REAL!"
66
+ #
67
+ # @faker.version 1.8.5
23
68
  def quote
24
69
  fetch('one_piece.quotes')
25
70
  end
26
71
 
72
+ ##
73
+ # Produces an akuma no mi from One Piece.
74
+ #
75
+ # @return [String]
76
+ #
77
+ # @example
78
+ # Faker::JapaneseMedia::OnePiece.akuma_no_mi #=> "Gomu Gomu no Mi"
79
+ #
80
+ # @faker.version 1.8.5
27
81
  def akuma_no_mi
28
82
  fetch('one_piece.akumas_no_mi')
29
83
  end
@@ -4,14 +4,42 @@ module Faker
4
4
  class Movies
5
5
  class BackToTheFuture < Base
6
6
  class << self
7
+ ##
8
+ # Produces a character from Back to the Future.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Movies::BackToTheFuture.character #=> "Marty McFly"
14
+ #
15
+ # @faker.version 1.8.5
7
16
  def character
8
17
  fetch('back_to_the_future.characters')
9
18
  end
10
19
 
20
+ ##
21
+ # Produces a date from Back to the Future.
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Movies::BackToTheFuture.date #=> "November 5, 1955"
27
+ #
28
+ # @faker.version 1.8.5
11
29
  def date
12
30
  fetch('back_to_the_future.dates')
13
31
  end
14
32
 
33
+ ##
34
+ # Produces a quote from Back to the Future.
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Movies::BackToTheFuture.quote
40
+ # #=> "Roads? Where we're going, we don't need roads."
41
+ #
42
+ # @faker.version 1.8.5
15
43
  def quote
16
44
  fetch('back_to_the_future.quotes')
17
45
  end
@@ -4,14 +4,42 @@ module Faker
4
4
  class Movies
5
5
  class Ghostbusters < Base
6
6
  class << self
7
+ ##
8
+ # Produces an actor from Ghostbusters.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Movies::Ghostbusters.actor #=> "Bill Murray"
14
+ #
15
+ # @faker.version 1.9.2
7
16
  def actor
8
17
  fetch('ghostbusters.actors')
9
18
  end
10
19
 
20
+ ##
21
+ # Produces a character from Ghostbusters.
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Movies::Ghostbusters.character #=> "Dr. Egon Spengler"
27
+ #
28
+ # @faker.version 1.9.2
11
29
  def character
12
30
  fetch('ghostbusters.characters')
13
31
  end
14
32
 
33
+ ##
34
+ # Produces a quote from Ghostbusters.
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Movies::Ghostbusters.quote
40
+ # #=> "I tried to think of the most harmless thing. Something I loved from my childhood. Something that could never ever possibly destroy us. Mr. Stay Puft!"
41
+ #
42
+ # @faker.version 1.9.2
15
43
  def quote
16
44
  fetch('ghostbusters.quotes')
17
45
  end
@@ -4,26 +4,80 @@ module Faker
4
4
  class Movies
5
5
  class HarryPotter < Base
6
6
  class << self
7
+ ##
8
+ # Produces a character from Harry Potter.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Movies::HarryPotter.character #=> "Harry Potter"
14
+ #
15
+ # @faker.version 1.7.3
7
16
  def character
8
17
  fetch('harry_potter.characters')
9
18
  end
10
19
 
20
+ ##
21
+ # Produces a location from Harry Potter.
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Movies::HarryPotter.location #=> "Hogwarts"
27
+ #
28
+ # @faker.version 1.7.3
11
29
  def location
12
30
  fetch('harry_potter.locations')
13
31
  end
14
32
 
33
+ ##
34
+ # Produces a quote from Harry Potter.
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Movies::HarryPotter.quote #=> "I solemnly swear that I am up to good."
40
+ #
41
+ # @faker.version 1.7.3
15
42
  def quote
16
43
  fetch('harry_potter.quotes')
17
44
  end
18
45
 
46
+ ##
47
+ # Produces a book from Harry Potter.
48
+ #
49
+ # @return [String]
50
+ #
51
+ # @example
52
+ # Faker::Movies::HarryPotter.book #=> "Harry Potter and the Chamber of Secrets"
53
+ #
54
+ # @faker.version 1.7.3
19
55
  def book
20
56
  fetch('harry_potter.books')
21
57
  end
22
58
 
59
+ ##
60
+ # Produces a house from Harry Potter.
61
+ #
62
+ # @return [String]
63
+ #
64
+ # @example
65
+ # Faker::Movies::HarryPotter.house #=> "Gryffindor"
66
+ #
67
+ # @faker.version 1.7.3
23
68
  def house
24
69
  fetch('harry_potter.houses')
25
70
  end
26
71
 
72
+ ##
73
+ # Produces a spell from Harry Potter.
74
+ #
75
+ # @return [String]
76
+ #
77
+ # @example
78
+ # Faker::Movies::HarryPotter.spell #=> "Reparo"
79
+ #
80
+ # @faker.version 1.7.3
27
81
  def spell
28
82
  fetch('harry_potter.spells')
29
83
  end