faker 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f048f99db924a824430ec4b564d6526df4912994e5837146e309adfa35d8a8b5
4
- data.tar.gz: a6d6c98bd04fb29faaa2549e51053d882cf930dd4fae38b478e8e35230e496ab
3
+ metadata.gz: f753c6745324477819be7fa8671395eaf8d64269de47b0aaa366ab3cb0b28655
4
+ data.tar.gz: ccbb9fe077964f47444c76843548ff3c9272b321ec6e4c246ce66a2fe772bc7e
5
5
  SHA512:
6
- metadata.gz: 6e389da23548bfd30277a61c39051a874fb1da29b4af4258b11c8327eef7a2707c5862983eecd93658331d2c89643a18a588a3f978a3de3276511a501ff2f659
7
- data.tar.gz: 9028bfe72719c6f4da2653bfc17f50fac5559a1238175045b9aaad4dd86fd404b12048e5e9ba6dbe7d3ab388300b5ff8763e0c0f9984fa51d57b2c760e5c02cb
6
+ metadata.gz: a74a4e4fe1fdcafd4a09f379d3fd9955bb09c1a3bcc1ed8d996aec2d7fd7ec8cdbeb898ce536f9778dfdc55779c0b715bff3a8edd11545c5690e2a1f1e79e3b7
7
+ data.tar.gz: f6ede2e9b87b99c453b79dad0d2ee57b0b542a72ab8efb166a8a4aeb3c5d6308285c6d6984787542660cfb8a0d99cf5f9419a7cfc6768f74a933ea9c7d63725f
@@ -1,5 +1,39 @@
1
1
  # Change Log
2
2
 
3
+ ## [v2.5.0](https://github.com/faker-ruby/faker/tree/v2.5.0) (2019-30-09)
4
+
5
+ This version introduces:
6
+ - locales for Thai language - the mother language in Thailand
7
+ - YARD documentation for faker interfaces
8
+ - locales updates or fixes
9
+
10
+ ## Feature Request
11
+
12
+ - [PR #1773](https://github.com/faker-ruby/faker/pull/1773) Two new locales added: th and en-th [@kodram](https://github.com/kodram)
13
+
14
+ ## Documentation
15
+
16
+ - [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)
17
+ - [PR #1767](https://github.com/faker-ruby/faker/pull/1767) Fix two incorrect flexible method calls. [@connorshea](https://github.com/connorshea)
18
+ - [PR #1761](https://github.com/faker-ruby/faker/pull/1761) Add YARD docs for the Basketball and Football fakers. [@connorshea](https://github.com/connorshea)
19
+ - [PR #1768](https://github.com/faker-ruby/faker/pull/1768) Add YARD docs for Faker::Restaurant. [@connorshea](https://github.com/connorshea)
20
+ - [PR #1759](https://github.com/faker-ruby/faker/pull/1759) Add YARD docs for all remaining TV Shows [@connorshea](https://github.com/connorshea)
21
+ - [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)
22
+ - [PR #1756](https://github.com/faker-ruby/faker/pull/1756) Add more miscellaneous YARD docs [@connorshea](https://github.com/connorshea)
23
+ - [PR #1753](https://github.com/faker-ruby/faker/pull/1753) Add YARD docs for Date, Time, and Number [@connorshea](https://github.com/connorshea)
24
+
25
+ ## Update locales
26
+
27
+ - [PR #1764](https://github.com/faker-ruby/faker/pull/1764) Remove "mint green" from color [@ro-savage](https://github.com/ro-savage)
28
+ - [PR #1751](https://github.com/faker-ruby/faker/pull/1751) fix from Color.name to Color.color_name [@4geru](https://github.com/4geru)
29
+
30
+ ## Update local dependencies
31
+
32
+ The following development dependencies were updated:
33
+ - Update minitest requirement from = 5.11.3 to = 5.12.0 (#1763)
34
+
35
+ ------------------------------------------------------------------------------
36
+
3
37
  ## [v2.4.0](https://github.com/faker-ruby/faker/tree/v2.4.0) (2019-19-09)
4
38
 
5
39
  ## Documentation
@@ -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|
@@ -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
@@ -73,6 +73,8 @@ module Faker
73
73
  end
74
74
  end
75
75
 
76
+ # rubocop:disable Metrics/ParameterLists
77
+
76
78
  ##
77
79
  # Produces a randomized string of characters suitable for passwords
78
80
  #
@@ -95,8 +97,8 @@ module Faker
95
97
  # Faker::Internet.password(min_length: 10, max_length: 20, mix_case: true, special_characters: true) #=> "*%NkOnJsH4"
96
98
  #
97
99
  # @faker.version 2.1.3
98
- # rubocop:disable Metrics/ParameterLists
99
100
  def password(legacy_min_length = NOT_GIVEN, legacy_max_length = NOT_GIVEN, legacy_mix_case = NOT_GIVEN, legacy_special_characters = NOT_GIVEN, min_length: 8, max_length: 16, mix_case: true, special_characters: false)
101
+ # rubocop:enable Metrics/ParameterLists
100
102
  warn_for_deprecated_arguments do |keywords|
101
103
  keywords << :min_length if legacy_min_length != NOT_GIVEN
102
104
  keywords << :max_length if legacy_max_length != NOT_GIVEN
@@ -239,6 +241,7 @@ module Faker
239
241
  "#{ip_v6_address}/#{rand(1..127)}"
240
242
  end
241
243
 
244
+ # rubocop:disable Metrics/ParameterLists
242
245
  def url(legacy_host = NOT_GIVEN, legacy_path = NOT_GIVEN, legacy_scheme = NOT_GIVEN, host: domain_name, path: "/#{username}", scheme: 'http')
243
246
  # rubocop:enable Metrics/ParameterLists
244
247
  warn_for_deprecated_arguments do |keywords|
@@ -4,27 +4,70 @@ module Faker
4
4
  class Nation < Base
5
5
  flexible :nation
6
6
  class << self
7
- # Fetch random nationality
7
+ ##
8
+ # Produces a random nationality.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Nation.nationality #=> "Nepalese"
14
+ #
15
+ # @faker.version 1.9.0
8
16
  def nationality
9
17
  fetch('nation.nationality')
10
18
  end
11
19
 
12
- # Fetch random national flag emoji
20
+ # rubocop:disable Style/AsciiComments
21
+
22
+ ##
23
+ # Produces a random national flag emoji.
24
+ #
25
+ # @return [String]
26
+ #
27
+ # @example
28
+ # Faker::Nation.flag #=> "🇫🇮"
29
+ #
30
+ # @faker.version 1.9.0
13
31
  def flag
14
32
  sample(translate('faker.nation.flag')).pack('C*').force_encoding('utf-8')
15
33
  end
34
+ # rubocop:enable Style/AsciiComments
16
35
 
17
- # Fetch random language
36
+ ##
37
+ # Produces a random national language.
38
+ #
39
+ # @return [String]
40
+ #
41
+ # @example
42
+ # Faker::Nation.language #=> "Nepali"
43
+ #
44
+ # @faker.version 1.9.0
18
45
  def language
19
46
  fetch('nation.language')
20
47
  end
21
48
 
22
- # Fetch random capital city
49
+ ##
50
+ # Produces a random capital city.
51
+ #
52
+ # @return [String]
53
+ #
54
+ # @example
55
+ # Faker::Nation.capital_city #=> "Kathmandu"
56
+ #
57
+ # @faker.version 1.9.0
23
58
  def capital_city
24
59
  fetch('nation.capital_city')
25
60
  end
26
61
 
27
- # Fetch random natinal sport
62
+ ##
63
+ # Produces a random national sport.
64
+ #
65
+ # @return [String]
66
+ #
67
+ # @example
68
+ # Faker::Nation.national_sport #=> "dandi biyo"
69
+ #
70
+ # @faker.version 1.9.0
28
71
  def national_sport
29
72
  fetch('team.sport')
30
73
  end
@@ -3,6 +3,16 @@
3
3
  module Faker
4
4
  class Number < Base
5
5
  class << self
6
+ ##
7
+ # Produce a random number.
8
+ #
9
+ # @param digits [Integer] Number of digits that the generated number should have.
10
+ # @return [Integer]
11
+ #
12
+ # @example
13
+ # Faker::Number.number(digits: 10) #=> 1968353479
14
+ #
15
+ # @faker.version 1.0.0
6
16
  def number(legacy_digits = NOT_GIVEN, digits: 10)
7
17
  warn_for_deprecated_arguments do |keywords|
8
18
  keywords << :digits if legacy_digits != NOT_GIVEN
@@ -15,6 +25,16 @@ module Faker
15
25
  ([non_zero_digit] + generate(digits - 1)).join.to_i
16
26
  end
17
27
 
28
+ ##
29
+ # Produce a random number with a leading zero.
30
+ #
31
+ # @param digits [Integer] Number of digits that the generated number should have.
32
+ # @return [String]
33
+ #
34
+ # @example
35
+ # Faker::Number.leading_zero_number(digits: 10) #=> "0669336915"
36
+ #
37
+ # @faker.version 1.0.0
18
38
  def leading_zero_number(legacy_digits = NOT_GIVEN, digits: 10)
19
39
  warn_for_deprecated_arguments do |keywords|
20
40
  keywords << :digits if legacy_digits != NOT_GIVEN
@@ -23,6 +43,16 @@ module Faker
23
43
  '0' + (2..digits).collect { digit }.join
24
44
  end
25
45
 
46
+ ##
47
+ # Produce a number with a number of digits, preserves leading zeroes.
48
+ #
49
+ # @param digits [Integer] Number of digits that the generated number should have.
50
+ # @return [String]
51
+ #
52
+ # @example
53
+ # Faker::Number.decimal_part(digits: 2) #=> "09"
54
+ #
55
+ # @faker.version 1.0.0
26
56
  def decimal_part(legacy_digits = NOT_GIVEN, digits: 10)
27
57
  warn_for_deprecated_arguments do |keywords|
28
58
  keywords << :digits if legacy_digits != NOT_GIVEN
@@ -36,6 +66,18 @@ module Faker
36
66
  leading_zero_number(digits: digits) + num.to_s
37
67
  end
38
68
 
69
+ ##
70
+ # Produces a float.
71
+ #
72
+ # @param l_digits [Integer] Number of digits that the generated decimal should have to the left of the decimal point.
73
+ # @param r_digits [Integer] Number of digits that the generated decimal should have to the right of the decimal point.
74
+ # @return [Float]
75
+ #
76
+ # @example
77
+ # Faker::Number.decimal(l_digits: 2) #=> 11.88
78
+ # Faker::Number.decimal(l_digits: 3, r_digits: 3) #=> 181.843
79
+ #
80
+ # @faker.version 1.0.0
39
81
  def decimal(legacy_l_digits = NOT_GIVEN, legacy_r_digits = NOT_GIVEN, l_digits: 5, r_digits: 2)
40
82
  warn_for_deprecated_arguments do |keywords|
41
83
  keywords << :l_digits if legacy_l_digits != NOT_GIVEN
@@ -53,14 +95,42 @@ module Faker
53
95
  "#{l_d}.#{r_d}".to_f
54
96
  end
55
97
 
98
+ ##
99
+ # Produces a non-zero single-digit integer.
100
+ #
101
+ # @return [Integer]
102
+ #
103
+ # @example
104
+ # Faker::Number.non_zero_digit #=> 8
105
+ #
106
+ # @faker.version 1.0.0
56
107
  def non_zero_digit
57
108
  rand(1..9)
58
109
  end
59
110
 
111
+ ##
112
+ # Produces a single-digit integer.
113
+ #
114
+ # @return [Integer]
115
+ #
116
+ # @example
117
+ # Faker::Number.digit #=> 1
118
+ #
119
+ # @faker.version 1.0.0
60
120
  def digit
61
121
  rand(10)
62
122
  end
63
123
 
124
+ ##
125
+ # Produces a number in hexadecimal format.
126
+ #
127
+ # @param digits [Integer] Number of digits in the he
128
+ # @return [String]
129
+ #
130
+ # @example
131
+ # Faker::Number.hexadecimal(digits: 3) #=> "e74"
132
+ #
133
+ # @faker.version 1.0.0
64
134
  def hexadecimal(legacy_digits = NOT_GIVEN, digits: 6)
65
135
  warn_for_deprecated_arguments do |keywords|
66
136
  keywords << :digits if legacy_digits != NOT_GIVEN
@@ -71,6 +141,17 @@ module Faker
71
141
  hex
72
142
  end
73
143
 
144
+ ##
145
+ # Produces a float given a mean and standard deviation.
146
+ #
147
+ # @param mean [Integer]
148
+ # @param standard_deviation [Integer, Float]
149
+ # @return [Float]
150
+ #
151
+ # @example
152
+ # Faker::Number.normal(mean: 50, standard_deviation: 3.5) #=> 47.14669604069156
153
+ #
154
+ # @faker.version 1.0.0
74
155
  def normal(legacy_mean = NOT_GIVEN, legacy_standard_deviation = NOT_GIVEN, mean: 1, standard_deviation: 1)
75
156
  warn_for_deprecated_arguments do |keywords|
76
157
  keywords << :mean if legacy_mean != NOT_GIVEN
@@ -83,6 +164,17 @@ module Faker
83
164
  mean + scale * Math.cos(theta)
84
165
  end
85
166
 
167
+ ##
168
+ # Produces a number between two provided values. Boundaries are inclusive.
169
+ #
170
+ # @param from [Integer] The lowest number to include.
171
+ # @param to [Integer] The highest number to include.
172
+ # @return [Integer]
173
+ #
174
+ # @example
175
+ # Faker::Number.between(from: 1, to: 10) #=> 7
176
+ #
177
+ # @faker.version 1.0.0
86
178
  def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 1.00, to: 5000.00)
87
179
  warn_for_deprecated_arguments do |keywords|
88
180
  keywords << :from if legacy_from != NOT_GIVEN
@@ -92,6 +184,16 @@ module Faker
92
184
  Faker::Base.rand_in_range(from, to)
93
185
  end
94
186
 
187
+ ##
188
+ # Produces a number within two provided values. Boundaries are inclusive or exclusive depending on the range passed.
189
+ #
190
+ # @param range [Range] The range from which to generate a number.
191
+ # @return [Integer]
192
+ #
193
+ # @example
194
+ # Faker::Number.within(range: 1..10) #=> 7
195
+ #
196
+ # @faker.version 1.0.0
95
197
  def within(legacy_range = NOT_GIVEN, range: 1.00..5000.00)
96
198
  warn_for_deprecated_arguments do |keywords|
97
199
  keywords << :range if legacy_range != NOT_GIVEN
@@ -100,6 +202,17 @@ module Faker
100
202
  between(from: range.min, to: range.max)
101
203
  end
102
204
 
205
+ ##
206
+ # Produces a positive float.
207
+ #
208
+ # @param from [Integer] The lower boundary.
209
+ # @param to [Integer] The higher boundary.
210
+ # @return [Float]
211
+ #
212
+ # @example
213
+ # Faker::Number.positive #=> 235.59238499107653
214
+ #
215
+ # @faker.version 1.0.0
103
216
  def positive(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 1.00, to: 5000.00)
104
217
  warn_for_deprecated_arguments do |keywords|
105
218
  keywords << :from if legacy_from != NOT_GIVEN
@@ -111,6 +224,17 @@ module Faker
111
224
  greater_than_zero(random_number)
112
225
  end
113
226
 
227
+ ##
228
+ # Produces a negative float.
229
+ #
230
+ # @param from [Integer] The lower boundary.
231
+ # @param to [Integer] The higher boundary.
232
+ # @return [Float]
233
+ #
234
+ # @example
235
+ # Faker::Number.negative #=> -4480.042585669558
236
+ #
237
+ # @faker.version 1.0.0
114
238
  def negative(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: -5000.00, to: -1.00)
115
239
  warn_for_deprecated_arguments do |keywords|
116
240
  keywords << :from if legacy_from != NOT_GIVEN