faker 2.3.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +85 -2
  3. data/README.md +2 -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/industry_segments.rb +36 -0
  16. data/lib/faker/default/internet.rb +4 -1
  17. data/lib/faker/default/marketing.rb +9 -0
  18. data/lib/faker/default/military.rb +45 -0
  19. data/lib/faker/default/nation.rb +48 -5
  20. data/lib/faker/default/nato_phonetic_alphabet.rb +9 -0
  21. data/lib/faker/default/number.rb +124 -0
  22. data/lib/faker/default/restaurant.rb +54 -2
  23. data/lib/faker/default/science.rb +27 -0
  24. data/lib/faker/default/subscription.rb +45 -0
  25. data/lib/faker/default/superhero.rb +45 -0
  26. data/lib/faker/default/time.rb +85 -8
  27. data/lib/faker/default/world_cup.rb +50 -0
  28. data/lib/faker/games/dota.rb +47 -0
  29. data/lib/faker/games/heroes.rb +27 -0
  30. data/lib/faker/games/heroes_of_the_storm.rb +36 -0
  31. data/lib/faker/games/league_of_legends.rb +54 -0
  32. data/lib/faker/games/myst.rb +45 -0
  33. data/lib/faker/games/pokemon.rb +27 -0
  34. data/lib/faker/games/sonic_the_hedgehog.rb +27 -0
  35. data/lib/faker/games/witcher.rb +54 -0
  36. data/lib/faker/games/world_of_warcraft.rb +18 -0
  37. data/lib/faker/games/zelda.rb +1 -1
  38. data/lib/faker/japanese_media/dragon_ball.rb +9 -0
  39. data/lib/faker/japanese_media/one_piece.rb +54 -0
  40. data/lib/faker/japanese_media/sword_art_online.rb +36 -0
  41. data/lib/faker/movies/back_to_the_future.rb +28 -0
  42. data/lib/faker/movies/ghostbusters.rb +28 -0
  43. data/lib/faker/movies/harry_potter.rb +54 -0
  44. data/lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb +69 -0
  45. data/lib/faker/movies/hobbit.rb +37 -0
  46. data/lib/faker/movies/lebowski.rb +27 -0
  47. data/lib/faker/movies/lord_of_the_rings.rb +28 -0
  48. data/lib/faker/movies/movie.rb +9 -0
  49. data/lib/faker/movies/princess_bride.rb +19 -0
  50. data/lib/faker/movies/star_wars.rb +94 -0
  51. data/lib/faker/movies/v_for_vendetta.rb +29 -0
  52. data/lib/faker/music/grateful_dead.rb +18 -0
  53. data/lib/faker/music/phish.rb +9 -0
  54. data/lib/faker/music/rock_band.rb +9 -0
  55. data/lib/faker/music/umphreys_mcgee.rb +9 -0
  56. data/lib/faker/sports/basketball.rb +36 -0
  57. data/lib/faker/sports/football.rb +45 -0
  58. data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +9 -0
  59. data/lib/faker/tv_shows/bojack_horseman.rb +28 -0
  60. data/lib/faker/tv_shows/buffy.rb +45 -0
  61. data/lib/faker/tv_shows/community.rb +19 -0
  62. data/lib/faker/tv_shows/dr_who.rb +78 -2
  63. data/lib/faker/tv_shows/dumb_and_dumber.rb +28 -0
  64. data/lib/faker/tv_shows/family_guy.rb +28 -0
  65. data/lib/faker/tv_shows/friends.rb +27 -0
  66. data/lib/faker/tv_shows/game_of_thrones.rb +46 -0
  67. data/lib/faker/tv_shows/hey_arnold.rb +27 -0
  68. data/lib/faker/tv_shows/how_i_met_your_mother.rb +37 -0
  69. data/lib/faker/tv_shows/michael_scott.rb +13 -0
  70. data/lib/faker/tv_shows/new_girl.rb +19 -0
  71. data/lib/faker/tv_shows/parks_and_rec.rb +18 -0
  72. data/lib/faker/tv_shows/rick_and_morty.rb +28 -0
  73. data/lib/faker/tv_shows/ru_paul.rb +18 -0
  74. data/lib/faker/tv_shows/seinfeld.rb +28 -0
  75. data/lib/faker/tv_shows/silicon_valley.rb +75 -0
  76. data/lib/faker/tv_shows/simpsons.rb +28 -0
  77. data/lib/faker/tv_shows/south_park.rb +19 -0
  78. data/lib/faker/tv_shows/star_trek.rb +36 -0
  79. data/lib/faker/tv_shows/stargate.rb +28 -0
  80. data/lib/faker/tv_shows/stranger_things.rb +19 -0
  81. data/lib/faker/tv_shows/the_expanse.rb +36 -0
  82. data/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb +28 -0
  83. data/lib/faker/tv_shows/the_it_crowd.rb +37 -0
  84. data/lib/faker/tv_shows/the_thick_of_it.rb +28 -0
  85. data/lib/faker/tv_shows/twin_peaks.rb +28 -0
  86. data/lib/faker/tv_shows/venture_bros.rb +38 -0
  87. data/lib/faker/version.rb +1 -1
  88. data/lib/locales/en-TH.yml +360 -0
  89. data/lib/locales/en/color.yml +1 -1
  90. data/lib/locales/en/dr_who.yml +1 -1
  91. data/lib/locales/en/science.yml +1 -1
  92. data/lib/locales/ja.yml +7 -8
  93. data/lib/locales/th.yml +380 -0
  94. metadata +26 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bec55e97c49aba2834c60f979ddfbbba32d561b6300640059e10b74f4f64a11
4
- data.tar.gz: 60197e5cfab12ef29607bfb817a86fb14db6757d3868afbc5dd2a2751412e070
3
+ metadata.gz: 74df7e5e60856bfe1283a1e8de2b425e3b5617dfc9de2a05d651ab7ef69a35c0
4
+ data.tar.gz: 53b1457eb640182a15c4a34eb909aa252bd2f34b3990ef28ff2e8390b8417638
5
5
  SHA512:
6
- metadata.gz: 6163f75344392f843e01d14ff8ddb484c40ad7b8b055a1e7a3be1cfebb972b5e5244ac4f61b424862d997bee39c4d3b61d1b605aebad6f6534e771acb32ca380
7
- data.tar.gz: 93310c967dc3daa9a664d456978a636b7bc01122fbbe4a1c565206db401bfcdadee214d01c0e4b2b22be4c001cdf255de5f46762df2cb16d9f4e5fcb2c006418
6
+ metadata.gz: b5f3096b849d9aca43c94143b40411b52b29ea5c67468dd8a3f880d684ed7df02f4128281ffe36d8d144a3258324e64b3d7f3095177bee0cee066fa309beb14e
7
+ data.tar.gz: b303d58bc31496ad5913d273ab05b08b0dd8d45560725e15fd7c44200b0afb674671a2c70e3a291aad65a39367d3bd5b5ca63c206f219df8347fe260d0e41a4a
@@ -1,5 +1,88 @@
1
1
  # Change Log
2
2
 
3
+ ## [v2.6.0](https://github.com/faker-ruby/faker/tree/v2.6.0) (2019-10-10)
4
+
5
+ This version:
6
+ - adds `Faker::Date.in_date_period`
7
+ - adds `Faker::WorldCup` YARD docs
8
+ - updates local dependencies
9
+
10
+ ## Documentation
11
+
12
+ - [PR #1789](https://github.com/faker-ruby/faker/pull/1789) Faker::WorldCup YARD docs [@ashishra0](https://github.com/ashishra0)
13
+
14
+ ## Feature Request
15
+
16
+ - [PR #1755](https://github.com/faker-ruby/faker/pull/1755) Add Faker::Date.in_date_period [@AmrAdelKhalil](https://github.com/AmrAdelKhalil)
17
+
18
+ ## Update local dependencies
19
+
20
+ The following development dependencies were updated:
21
+ - Update rake requirement from = 12.3.3 to = 13.0.0 (#1776)
22
+ - Update minitest requirement from = 5.12.0 to = 5.12.2 (#1775)
23
+ - Update test-unit requirement from = 3.3.3 to = 3.3.4 (#1774)
24
+
25
+ ------------------------------------------------------------------------------
26
+
27
+ ## [v2.5.0](https://github.com/faker-ruby/faker/tree/v2.5.0) (2019-30-09)
28
+
29
+ This version introduces:
30
+ - locales for Thai language - the mother language in Thailand
31
+ - YARD documentation for faker interfaces
32
+ - locales updates or fixes
33
+
34
+ ## Feature Request
35
+
36
+ - [PR #1773](https://github.com/faker-ruby/faker/pull/1773) Two new locales added: th and en-th [@kodram](https://github.com/kodram)
37
+
38
+ ## Documentation
39
+
40
+ - [PR #1771](https://github.com/faker-ruby/faker/pull/1771) Fix some rubocop comments that were showing up in YARD docs. [@connorshea](https://github.com/connorshea)
41
+ - [PR #1767](https://github.com/faker-ruby/faker/pull/1767) Fix two incorrect flexible method calls. [@connorshea](https://github.com/connorshea)
42
+ - [PR #1761](https://github.com/faker-ruby/faker/pull/1761) Add YARD docs for the Basketball and Football fakers. [@connorshea](https://github.com/connorshea)
43
+ - [PR #1768](https://github.com/faker-ruby/faker/pull/1768) Add YARD docs for Faker::Restaurant. [@connorshea](https://github.com/connorshea)
44
+ - [PR #1759](https://github.com/faker-ruby/faker/pull/1759) Add YARD docs for all remaining TV Shows [@connorshea](https://github.com/connorshea)
45
+ - [PR #1758](https://github.com/faker-ruby/faker/pull/1758) Add YARD docs for Doctor Who and fix a method name. [@connorshea](https://github.com/connorshea)
46
+ - [PR #1756](https://github.com/faker-ruby/faker/pull/1756) Add more miscellaneous YARD docs [@connorshea](https://github.com/connorshea)
47
+ - [PR #1753](https://github.com/faker-ruby/faker/pull/1753) Add YARD docs for Date, Time, and Number [@connorshea](https://github.com/connorshea)
48
+
49
+ ## Update locales
50
+
51
+ - [PR #1764](https://github.com/faker-ruby/faker/pull/1764) Remove "mint green" from color [@ro-savage](https://github.com/ro-savage)
52
+ - [PR #1751](https://github.com/faker-ruby/faker/pull/1751) fix from Color.name to Color.color_name [@4geru](https://github.com/4geru)
53
+
54
+ ## Update local dependencies
55
+
56
+ The following development dependencies were updated:
57
+ - Update minitest requirement from = 5.11.3 to = 5.12.0 (#1763)
58
+
59
+ ------------------------------------------------------------------------------
60
+
61
+ ## [v2.4.0](https://github.com/faker-ruby/faker/tree/v2.4.0) (2019-19-09)
62
+
63
+ ## Documentation
64
+
65
+ - [PR #1750](https://github.com/faker-ruby/faker/pull/1750) add only japanese word spec [@4geru](https://github.com/4geru)
66
+ - [PR #1740](https://github.com/faker-ruby/faker/pull/1740) Add more YARD docs [@connorshea](https://github.com/connorshea)
67
+ - [PR #1747](https://github.com/faker-ruby/faker/pull/1747) Fix PR links [@geniou](https://github.com/geniou)
68
+
69
+ ## Feature Request
70
+
71
+ - [PR #1742](https://github.com/faker-ruby/faker/pull/1742) Add Faker::Blockchain::Aeternity [@2pd](https://github.com/2pd)
72
+
73
+ ## Update locales
74
+
75
+ - [PR #1743](https://github.com/faker-ruby/faker/pull/1743) Fix another ambiguity in element_symbol field [@psibi](https://github.com/psibi)
76
+ - [PR #1748](https://github.com/faker-ruby/faker/pull/1748) fix typo from bread to breed [@4geru](https://github.com/4geru)
77
+ - [PR #1752](https://github.com/faker-ruby/faker/pull/1752) fix creature i18n path in japanese [@4geru](https://github.com/4geru)
78
+
79
+ ## Update local dependencies
80
+
81
+ The following development dependencies were updated:
82
+ - Update simplecov requirement from = 0.17.0 to = 0.17.1 (#1749)
83
+
84
+ ------------------------------------------------------------------------------
85
+
3
86
  ## [v2.3.0](https://github.com/faker-ruby/faker/tree/v2.3.0) (2019-12-09)
4
87
 
5
88
  ## Documentation
@@ -14,8 +97,8 @@
14
97
 
15
98
  ## Update locales
16
99
 
17
- - [PR #1732](https://github.com/faker-ruby/faker/pull/1732) Add pokemon name in Johto area [@mathieujobin](https://github.com/mathieujobin)
18
- - [PR #1723](https://github.com/faker-ruby/faker/pull/1723) Quebec province postal codes starts by [GHJ], adding missing two [@Ryutooooo](https://github.com/Ryutooooo)
100
+ - [PR #1723](https://github.com/faker-ruby/faker/pull/1723) Add pokemon name in Johto area [@mathieujobin](https://github.com/mathieujobin)
101
+ - [PR #1732](https://github.com/faker-ruby/faker/pull/1732) Quebec province postal codes starts by [GHJ], adding missing two [@Ryutooooo](https://github.com/Ryutooooo)
19
102
 
20
103
  ------------------------------------------------------------------------------
21
104
 
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  # Faker
5
5
  [![Build Status](https://travis-ci.org/faker-ruby/faker.svg?branch=master)](https://travis-ci.org/faker-ruby/faker)
6
6
  [![Gem Version](https://badge.fury.io/rb/faker.svg)](https://badge.fury.io/rb/faker)
7
- [![Inline docs](http://inch-ci.org/github/stympy/faker.svg?branch=master)](http://inch-ci.org/github/stympy/faker)
7
+ [![Inline docs](https://inch-ci.org/github/faker-ruby/faker.svg?branch=master)](https://inch-ci.org/github/faker-ruby/faker)
8
8
  [![Test Coverage](https://api.codeclimate.com/v1/badges/ef54c7f9df86e965d64b/test_coverage)](https://codeclimate.com/github/stympy/faker/test_coverage)
9
9
  [![Maintainability](https://api.codeclimate.com/v1/badges/ef54c7f9df86e965d64b/maintainability)](https://codeclimate.com/github/stympy/faker/maintainability)
10
10
 
@@ -211,6 +211,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
211
211
  - [Faker::WorldCup](doc/default/world_cup.md)
212
212
 
213
213
  ### Blockchain
214
+ - [Faker::Blockchain::Aeternity](doc/blockchain/aeternity.md)
214
215
  - [Faker::Blockchain::Bitcoin](doc/blockchain/bitcoin.md)
215
216
  - [Faker::Blockchain::Ethereum](doc/blockchain/ethereum.md)
216
217
  - [Faker::Blockchain::Tezos](doc/blockchain/tezos.md)
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Faker
4
+ class Blockchain
5
+ class Aeternity < Base
6
+ class << self
7
+ ##
8
+ # Produces a random Aeternity wallet address
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Blockchain::Aeternity.address
14
+ # #=> "ak_zvU8YQLagjcfng7Tg8yCdiZ1rpiWNp1PBn3vtUs44utSvbJVR"
15
+ #
16
+ def address
17
+ 'ak_' + rand_strings
18
+ end
19
+
20
+ ##
21
+ # Produces a random Aeternity transaction
22
+ #
23
+ # @return [String]
24
+ #
25
+ # @example
26
+ # Faker::Blockchain::Aeternity.transaction
27
+ # #=> "th_147nDP22h3pHrLt2qykTH4txUwQh1ccaXp"
28
+ #
29
+ def transaction
30
+ 'th_' + rand_strings(51)
31
+ end
32
+
33
+ ##
34
+ # Produces a random Aeternity contract
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @example
39
+ # Faker::Blockchain::Aeternity.contract
40
+ # #=> "ct_Hk2JsNeWGEYQEHHQCfcBeGrwbhtYSwFTPdDhW2SvjFYVojyhW"
41
+ #
42
+ def contract
43
+ 'ct_' + rand_strings
44
+ end
45
+
46
+ ##
47
+ # Produces a random Aeternity oracle
48
+ #
49
+ # @return [String]
50
+ #
51
+ # @example
52
+ # Faker::Blockchain::Aeternity.oracle
53
+ # #=> "ok_28QDg7fkF5qiKueSdUvUBtCYPJdmMEoS73CztzXCRAwMGKHKZh"
54
+ #
55
+ def oracle
56
+ 'ok_' + rand_strings(51)
57
+ end
58
+
59
+ protected
60
+
61
+ def rand_strings(length = 50)
62
+ hex_alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
63
+ var = +''
64
+ length.times { var << sample(shuffle(hex_alphabet.split(''))) }
65
+ var
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -42,6 +42,8 @@ module Faker
42
42
  parse('app.author')
43
43
  end
44
44
 
45
+ # rubocop:disable Metrics/ParameterLists
46
+
45
47
  ##
46
48
  # Produces a String representing a semantic version identifier.
47
49
  #
@@ -60,7 +62,6 @@ module Faker
60
62
  # Faker::App.semantic_version(patch: 5..6) #=> "7.2.6"
61
63
  #
62
64
  # @faker.version 1.4.3
63
- # rubocop:disable Metrics/ParameterLists
64
65
  def semantic_version(legacy_major = NOT_GIVEN, legacy_minor = NOT_GIVEN, legacy_patch = NOT_GIVEN, major: 0..9, minor: 0..9, patch: 1..9)
65
66
  # rubocop:enable Metrics/ParameterLists
66
67
  warn_for_deprecated_arguments do |keywords|
@@ -3,10 +3,28 @@
3
3
  module Faker
4
4
  class Appliance < Base
5
5
  class << self
6
+ ##
7
+ # Produces the name of an appliance brand.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::Appliance.brand #=> "Bosch"
13
+ #
14
+ # @faker.version 1.9.0
6
15
  def brand
7
16
  fetch('appliance.brand')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces the name of a type of appliance equipment.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::Appliance.equipment #=> "Appliance plug"
26
+ #
27
+ # @faker.version 1.9.0
10
28
  def equipment
11
29
  fetch('appliance.equipment')
12
30
  end
@@ -6,6 +6,8 @@ module Faker
6
6
  # @private
7
7
  SUPPORTED_FORMATS = %w[png jpg bmp].freeze
8
8
 
9
+ # rubocop:disable Metrics/ParameterLists
10
+
9
11
  ##
10
12
  # Produces a URL for an avatar from robohash.org
11
13
  #
@@ -36,7 +38,6 @@ module Faker
36
38
  # #=> "https://robohash.org/my-own-slug.bmp?size=50x50&set=set1&bgset=bg1"
37
39
  #
38
40
  # @faker.version 1.4.3
39
- # rubocop:disable Metrics/ParameterLists
40
41
  def image(legacy_slug = NOT_GIVEN, legacy_size = NOT_GIVEN, legacy_format = NOT_GIVEN, legacy_set = NOT_GIVEN, legacy_bgset = NOT_GIVEN, slug: nil, size: '300x300', format: 'png', set: 'set1', bgset: nil)
41
42
  # rubocop:enable Metrics/ParameterLists
42
43
  warn_for_deprecated_arguments do |keywords|
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Faker
4
4
  class ChuckNorris < Base
5
- flexible :name
5
+ flexible :chuck_norris
6
6
 
7
7
  class << self
8
8
  # from: https://github.com/jenkinsci/chucknorris-plugin/blob/master/src/main/java/hudson/plugins/chucknorris/FactGenerator.java
@@ -3,6 +3,18 @@
3
3
  module Faker
4
4
  class Date < Base
5
5
  class << self
6
+ ##
7
+ # Produce a random date between two dates.
8
+ #
9
+ # @param from [Date] The start of the usable date range.
10
+ # @param to [Date] The end of the usable date range.
11
+ # @return [Date]
12
+ #
13
+ # @example
14
+ # Faker::Date.between(from: 2.days.ago, to: Date.today)
15
+ # #=> #<Date: 2014-09-24>
16
+ #
17
+ # @faker.version 1.0.0
6
18
  def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from:, to:)
7
19
  warn_for_deprecated_arguments do |keywords|
8
20
  keywords << :from if legacy_from != NOT_GIVEN
@@ -16,8 +28,21 @@ module Faker
16
28
  end
17
29
 
18
30
  # rubocop:disable Metrics/ParameterLists
31
+
32
+ ##
33
+ # Produce a random date between two dates.
34
+ #
35
+ # @param from [Date] The start of the usable date range.
36
+ # @param to [Date] The end of the usable date range.
37
+ # @param excepted [Date] A date to exclude.
38
+ # @return [Date]
39
+ #
40
+ # @example
41
+ # Faker::Date.between_except(from: 1.year.ago, to: 1.year.from_now, excepted: Date.today)
42
+ # #=> #<Date: 2014-10-03>
43
+ #
44
+ # @faker.version 1.6.2
19
45
  def between_except(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, legacy_excepted = NOT_GIVEN, from:, to:, excepted:)
20
- # rubocop:enable Metrics/ParameterLists
21
46
  warn_for_deprecated_arguments do |keywords|
22
47
  keywords << :from if legacy_from != NOT_GIVEN
23
48
  end
@@ -37,7 +62,18 @@ module Faker
37
62
  break date.to_date if date != excepted
38
63
  end
39
64
  end
40
-
65
+ # rubocop:enable Metrics/ParameterLists
66
+
67
+ ##
68
+ # Produce a random date in the future (up to N days).
69
+ #
70
+ # @param days [Integer] The maximum number of days to go into the future.
71
+ # @return [Date]
72
+ #
73
+ # @example
74
+ # Faker::Date.forward(days: 23) #=> #<Date: 2014-10-03>
75
+ #
76
+ # @faker.version 1.0.0
41
77
  def forward(legacy_days = NOT_GIVEN, days: 365)
42
78
  warn_for_deprecated_arguments do |keywords|
43
79
  keywords << :days if legacy_days != NOT_GIVEN
@@ -49,6 +85,16 @@ module Faker
49
85
  between(from: from, to: to).to_date
50
86
  end
51
87
 
88
+ ##
89
+ # Produce a random date in the past (up to N days).
90
+ #
91
+ # @param days [Integer] The maximum number of days to go into the past.
92
+ # @return [Date]
93
+ #
94
+ # @example
95
+ # Faker::Date.backward(days: 14) #=> #<Date: 2019-09-12>
96
+ #
97
+ # @faker.version 1.0.0
52
98
  def backward(legacy_days = NOT_GIVEN, days: 365)
53
99
  warn_for_deprecated_arguments do |keywords|
54
100
  keywords << :days if legacy_days != NOT_GIVEN
@@ -60,6 +106,17 @@ module Faker
60
106
  between(from: from, to: to).to_date
61
107
  end
62
108
 
109
+ ##
110
+ # Produce a random date in the past (up to N days).
111
+ #
112
+ # @param min_age [Integer] The minimum age that the birthday would imply.
113
+ # @param max_age [Integer] The maximum age that the birthday would imply.
114
+ # @return [Date]
115
+ #
116
+ # @example
117
+ # Faker::Date.birthday(min_age: 18, max_age: 65) #=> #<Date: 1986-03-28>
118
+ #
119
+ # @faker.version 1.4.3
63
120
  def birthday(legacy_min_age = NOT_GIVEN, legacy_max_age = NOT_GIVEN, min_age: 18, max_age: 65)
64
121
  warn_for_deprecated_arguments do |keywords|
65
122
  keywords << :min_age if legacy_min_age != NOT_GIVEN
@@ -76,6 +133,30 @@ module Faker
76
133
  between(from: from, to: to).to_date
77
134
  end
78
135
 
136
+ ##
137
+ # Produces a date in the year and/or month specified.
138
+ #
139
+ # @param month [Integer] represents the month of the date
140
+ # @param year [Integer] represents the year of the date
141
+ # @return [Date]
142
+ #
143
+ # @example
144
+ # Faker::Date.in_date_period #=> #<Date: 2019-09-01>
145
+ #
146
+ # @example
147
+ # Faker::Date.in_date_period(year: 2018, month: 2) #=> #<Date: 2018-02-26>
148
+ #
149
+ # @example
150
+ # Faker::Date.in_date_period(month: 2) #=> #<Date: 2019-02-26>
151
+ #
152
+ # @faker.version next
153
+ def in_date_period(month: nil, year: ::Date.today.year)
154
+ from = ::Date.new(year, month || 1, 1)
155
+ to = ::Date.new(year, month || 12, ::Date.civil(year, month || 12, -1).day)
156
+
157
+ between(from: from, to: to).to_date
158
+ end
159
+
79
160
  private
80
161
 
81
162
  def birthday_date(date, age)
@@ -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