faker 2.3.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +118 -2
  3. data/README.md +5 -1
  4. data/lib/faker/blockchain/aeternity.rb +70 -0
  5. data/lib/faker/default/app.rb +2 -1
  6. data/lib/faker/default/appliance.rb +18 -0
  7. data/lib/faker/default/avatar.rb +2 -1
  8. data/lib/faker/default/chuck_norris.rb +1 -1
  9. data/lib/faker/default/date.rb +83 -2
  10. data/lib/faker/default/dessert.rb +27 -0
  11. data/lib/faker/default/device.rb +54 -0
  12. data/lib/faker/default/driving_licence.rb +2 -2
  13. data/lib/faker/default/electrical_components.rb +27 -0
  14. data/lib/faker/default/greek_philosophers.rb +18 -0
  15. data/lib/faker/default/id_number.rb +29 -0
  16. data/lib/faker/default/industry_segments.rb +36 -0
  17. data/lib/faker/default/internet.rb +4 -1
  18. data/lib/faker/default/marketing.rb +9 -0
  19. data/lib/faker/default/military.rb +45 -0
  20. data/lib/faker/default/nation.rb +48 -5
  21. data/lib/faker/default/nato_phonetic_alphabet.rb +9 -0
  22. data/lib/faker/default/number.rb +124 -0
  23. data/lib/faker/default/restaurant.rb +54 -2
  24. data/lib/faker/default/science.rb +27 -0
  25. data/lib/faker/default/subscription.rb +45 -0
  26. data/lib/faker/default/superhero.rb +45 -0
  27. data/lib/faker/default/time.rb +85 -8
  28. data/lib/faker/default/world_cup.rb +50 -0
  29. data/lib/faker/games/dota.rb +47 -0
  30. data/lib/faker/games/heroes.rb +27 -0
  31. data/lib/faker/games/heroes_of_the_storm.rb +36 -0
  32. data/lib/faker/games/league_of_legends.rb +54 -0
  33. data/lib/faker/games/myst.rb +45 -0
  34. data/lib/faker/games/pokemon.rb +27 -0
  35. data/lib/faker/games/sonic_the_hedgehog.rb +27 -0
  36. data/lib/faker/games/witcher.rb +54 -0
  37. data/lib/faker/games/world_of_warcraft.rb +18 -0
  38. data/lib/faker/games/zelda.rb +1 -1
  39. data/lib/faker/japanese_media/dragon_ball.rb +9 -0
  40. data/lib/faker/japanese_media/one_piece.rb +54 -0
  41. data/lib/faker/japanese_media/sword_art_online.rb +36 -0
  42. data/lib/faker/movies/back_to_the_future.rb +28 -0
  43. data/lib/faker/movies/ghostbusters.rb +28 -0
  44. data/lib/faker/movies/harry_potter.rb +54 -0
  45. data/lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb +69 -0
  46. data/lib/faker/movies/hobbit.rb +37 -0
  47. data/lib/faker/movies/lebowski.rb +27 -0
  48. data/lib/faker/movies/lord_of_the_rings.rb +28 -0
  49. data/lib/faker/movies/movie.rb +9 -0
  50. data/lib/faker/movies/princess_bride.rb +19 -0
  51. data/lib/faker/movies/star_wars.rb +94 -0
  52. data/lib/faker/movies/v_for_vendetta.rb +29 -0
  53. data/lib/faker/music/grateful_dead.rb +18 -0
  54. data/lib/faker/music/phish.rb +9 -0
  55. data/lib/faker/music/rock_band.rb +9 -0
  56. data/lib/faker/music/umphreys_mcgee.rb +9 -0
  57. data/lib/faker/sports/basketball.rb +36 -0
  58. data/lib/faker/sports/football.rb +45 -0
  59. data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +9 -0
  60. data/lib/faker/tv_shows/bojack_horseman.rb +28 -0
  61. data/lib/faker/tv_shows/buffy.rb +45 -0
  62. data/lib/faker/tv_shows/community.rb +19 -0
  63. data/lib/faker/tv_shows/dr_who.rb +78 -2
  64. data/lib/faker/tv_shows/dumb_and_dumber.rb +28 -0
  65. data/lib/faker/tv_shows/family_guy.rb +28 -0
  66. data/lib/faker/tv_shows/friends.rb +27 -0
  67. data/lib/faker/tv_shows/game_of_thrones.rb +46 -0
  68. data/lib/faker/tv_shows/hey_arnold.rb +27 -0
  69. data/lib/faker/tv_shows/how_i_met_your_mother.rb +37 -0
  70. data/lib/faker/tv_shows/michael_scott.rb +13 -0
  71. data/lib/faker/tv_shows/new_girl.rb +19 -0
  72. data/lib/faker/tv_shows/parks_and_rec.rb +18 -0
  73. data/lib/faker/tv_shows/rick_and_morty.rb +28 -0
  74. data/lib/faker/tv_shows/ru_paul.rb +18 -0
  75. data/lib/faker/tv_shows/seinfeld.rb +28 -0
  76. data/lib/faker/tv_shows/silicon_valley.rb +75 -0
  77. data/lib/faker/tv_shows/simpsons.rb +28 -0
  78. data/lib/faker/tv_shows/south_park.rb +19 -0
  79. data/lib/faker/tv_shows/star_trek.rb +36 -0
  80. data/lib/faker/tv_shows/stargate.rb +28 -0
  81. data/lib/faker/tv_shows/stranger_things.rb +19 -0
  82. data/lib/faker/tv_shows/the_expanse.rb +36 -0
  83. data/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb +28 -0
  84. data/lib/faker/tv_shows/the_it_crowd.rb +37 -0
  85. data/lib/faker/tv_shows/the_thick_of_it.rb +28 -0
  86. data/lib/faker/tv_shows/twin_peaks.rb +28 -0
  87. data/lib/faker/tv_shows/venture_bros.rb +38 -0
  88. data/lib/faker/version.rb +1 -1
  89. data/lib/locales/en-CA.yml +1 -0
  90. data/lib/locales/en-TH.yml +360 -0
  91. data/lib/locales/en/color.yml +1 -1
  92. data/lib/locales/en/dr_who.yml +1 -1
  93. data/lib/locales/en/science.yml +1 -1
  94. data/lib/locales/en/super_smash_bros.yml +1 -0
  95. data/lib/locales/fr-CA.yml +1 -1
  96. data/lib/locales/ja.yml +11 -8
  97. data/lib/locales/th.yml +380 -0
  98. metadata +26 -17
@@ -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,18 +3,56 @@
3
3
  module Faker
4
4
  class WorldCup < Base
5
5
  class << self
6
+ ##
7
+ # Produces a national team name.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::WorldCup.team #=> "Iran"
13
+ #
14
+ # @faker.version 1.9.0
6
15
  def team
7
16
  fetch('world_cup.teams')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces a city name hosting the World Cup match.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::WorldCup.city #=> "Moscow"
26
+ #
27
+ # @faker.version next
10
28
  def city
11
29
  fetch('world_cup.cities')
12
30
  end
13
31
 
32
+ ##
33
+ # Produces the name of a stadium that has hosted a World Cup match.
34
+ #
35
+ # @return [String]
36
+ #
37
+ # @example
38
+ # Faker::WorldCup.stadium #=> "Rostov Arena"
39
+ #
40
+ # @faker.version next
14
41
  def stadium
15
42
  fetch('world_cup.stadiums')
16
43
  end
17
44
 
45
+ ##
46
+ # Produces a random national team name from a group. See below examples
47
+ #
48
+ # @return [String]
49
+ #
50
+ # @example
51
+ # Faker::WorldCup.group(group: 'group_B') #=> "Spain"
52
+ # @example
53
+ # Faker::WorldCup.group #=> "Russia"
54
+ #
55
+ # @faker.version next
18
56
  def group(legacy_group = NOT_GIVEN, group: 'group_A')
19
57
  warn_for_deprecated_arguments do |keywords|
20
58
  keywords << :group if legacy_group != NOT_GIVEN
@@ -23,6 +61,18 @@ module Faker
23
61
  fetch("world_cup.groups.#{group}")
24
62
  end
25
63
 
64
+ ##
65
+ # Produces a random name from national team roster. See below examples.
66
+ #
67
+ # @return [String]
68
+ #
69
+ # @example
70
+ # Faker::WorldCup.roster #=> "Hector Cuper"
71
+ #
72
+ # @example
73
+ # Faker::WorldCup.roster(country: 'Spain', type: 'forwards') #=> "Diego Costa"
74
+ #
75
+ # @faker.version next
26
76
  def roster(legacy_country = NOT_GIVEN, legacy_type = NOT_GIVEN, country: 'Egypt', type: 'coach')
27
77
  warn_for_deprecated_arguments do |keywords|
28
78
  keywords << :country if legacy_country != NOT_GIVEN
@@ -4,22 +4,69 @@ module Faker
4
4
  class Games
5
5
  class Dota < Base
6
6
  class << self
7
+ ##
8
+ # Produces the name of a hero from Dota.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Games::Dota.hero #=> "Abaddon"
14
+ #
15
+ # @faker.version 1.9.0
7
16
  def hero
8
17
  fetch('games.dota.hero')
9
18
  end
10
19
 
20
+ ##
21
+ # Produces the name of an item from Dota.
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Games::Dota.item #=> "Armlet of Mordiggian"
27
+ #
28
+ # @faker.version 1.9.0
11
29
  def item
12
30
  fetch('games.dota.item')
13
31
  end
14
32
 
33
+ ##
34
+ # Produces the name of a professional Dota team.
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Games::Dota.team #=> "Evil Geniuses"
40
+ #
41
+ # @faker.version 1.9.0
15
42
  def team
16
43
  fetch('games.dota.team')
17
44
  end
18
45
 
46
+ ##
47
+ # Produces the name of a professional Dota player.
48
+ #
49
+ # @return [String]
50
+ #
51
+ # @example
52
+ # Faker::Games::Dota.player #=> "Dendi"
53
+ #
54
+ # @faker.version 1.9.0
19
55
  def player
20
56
  fetch('games.dota.player')
21
57
  end
22
58
 
59
+ ##
60
+ # Produces the name of a hero from Dota.
61
+ #
62
+ # @param hero [String] The name of a Dota hero.
63
+ # @return [String]
64
+ #
65
+ # @example
66
+ # Faker::Games::Dota.quote #=> "You have called death upon yourself."
67
+ # Faker::Games::Dota.quote(hero: 'alchemist') #=> "Better living through alchemy!"
68
+ #
69
+ # @faker.version 1.9.0
23
70
  def quote(legacy_hero = NOT_GIVEN, hero: 'abaddon')
24
71
  warn_for_deprecated_arguments do |keywords|
25
72
  keywords << :hero if legacy_hero != NOT_GIVEN
@@ -4,14 +4,41 @@ module Faker
4
4
  class Games
5
5
  class Heroes < Base
6
6
  class << self
7
+ ##
8
+ # Produces the name of a hero from Heroes 3.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Games::Heroes.name #=> "Christian"
14
+ #
15
+ # @faker.version 1.9.2
7
16
  def name
8
17
  fetch('heroes.names')
9
18
  end
10
19
 
20
+ ##
21
+ # Produces the name of a specialty from Heroes 3.
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Games::Heroes.specialty #=> "Ballista"
27
+ #
28
+ # @faker.version 1.9.2
11
29
  def specialty
12
30
  fetch('heroes.specialties')
13
31
  end
14
32
 
33
+ ##
34
+ # Produces the name of a class from Heroes 3.
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Games::Heroes.klass #=> "Knight"
40
+ #
41
+ # @faker.version 1.9.2
15
42
  def klass
16
43
  fetch('heroes.klasses')
17
44
  end
@@ -4,18 +4,54 @@ module Faker
4
4
  class Games
5
5
  class HeroesOfTheStorm < Base
6
6
  class << self
7
+ ##
8
+ # Produces a battleground from Heroes of the Storm.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Games::HeroesOfTheStorm.battleground #=> "Towers of Doom"
14
+ #
15
+ # @faker.version 1.9.2
7
16
  def battleground
8
17
  fetch('heroes_of_the_storm.battlegrounds')
9
18
  end
10
19
 
20
+ ##
21
+ # Produces a class from Heroes of the Storm.
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Games::HeroesOfTheStorm.class #=> "Support"
27
+ #
28
+ # @faker.version 1.9.2
11
29
  def class
12
30
  fetch('heroes_of_the_storm.classes')
13
31
  end
14
32
 
33
+ ##
34
+ # Produces a hero from Heroes of the Storm.
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Games::HeroesOfTheStorm.hero #=> "Illidan"
40
+ #
41
+ # @faker.version 1.9.2
15
42
  def hero
16
43
  fetch('heroes_of_the_storm.heroes')
17
44
  end
18
45
 
46
+ ##
47
+ # Produces a quote from Heroes of the Storm.
48
+ #
49
+ # @return [String]
50
+ #
51
+ # @example
52
+ # Faker::Games::HeroesOfTheStorm.quote #=> "MEAT!!!"
53
+ #
54
+ # @faker.version 1.9.2
19
55
  def quote
20
56
  fetch('heroes_of_the_storm.quotes')
21
57
  end
@@ -4,26 +4,80 @@ module Faker
4
4
  class Games
5
5
  class LeagueOfLegends < Base
6
6
  class << self
7
+ ##
8
+ # Produces the name of a champion from League of Legends.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Games::LeagueOfLegends.champion #=> "Jarvan IV"
14
+ #
15
+ # @faker.version 1.8.0
7
16
  def champion
8
17
  fetch('games.league_of_legends.champion')
9
18
  end
10
19
 
20
+ ##
21
+ # Produces a location from League of Legends.
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Games::LeagueOfLegends.location #=> "Demacia"
27
+ #
28
+ # @faker.version 1.8.0
11
29
  def location
12
30
  fetch('games.league_of_legends.location')
13
31
  end
14
32
 
33
+ ##
34
+ # Produces a quote from League of Legends.
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Games::LeagueOfLegends.quote #=> "Purge the unjust."
40
+ #
41
+ # @faker.version 1.8.0
15
42
  def quote
16
43
  fetch('games.league_of_legends.quote')
17
44
  end
18
45
 
46
+ ##
47
+ # Produces a summoner spell from League of Legends.
48
+ #
49
+ # @return [String]
50
+ #
51
+ # @example
52
+ # Faker::Games::LeagueOfLegends.summoner_spell #=> "Flash"
53
+ #
54
+ # @faker.version 1.8.0
19
55
  def summoner_spell
20
56
  fetch('games.league_of_legends.summoner_spell')
21
57
  end
22
58
 
59
+ ##
60
+ # Produces a mastery from League of Legends.
61
+ #
62
+ # @return [String]
63
+ #
64
+ # @example
65
+ # Faker::Games::LeagueOfLegends.masteries #=> "Double Edged Sword"
66
+ #
67
+ # @faker.version 1.8.0
23
68
  def masteries
24
69
  fetch('games.league_of_legends.masteries')
25
70
  end
26
71
 
72
+ ##
73
+ # Produces a rank from League of Legends.
74
+ #
75
+ # @return [String]
76
+ #
77
+ # @example
78
+ # Faker::Games::LeagueOfLegends.rank #=> "Bronze V"
79
+ #
80
+ # @faker.version 1.8.0
27
81
  def rank
28
82
  fetch('games.league_of_legends.rank')
29
83
  end