Skip to content

Commit

Permalink
Merge pull request #2204 from BigBigDoudou/update_documentation_for_b…
Browse files Browse the repository at this point in the history
…etween_and_within

update documentation to include Float type
  • Loading branch information
koic committed Feb 23, 2021
2 parents 3e8b5dd + db725d9 commit 0e219fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions doc/default/number.md
Expand Up @@ -30,10 +30,12 @@ Faker::Number.hexadecimal(digits: 3) #=> "e74"
# Boundary numbers are inclusive
# Keyword arguments: from, to
Faker::Number.between(from: 1, to: 10) #=> 7
Faker::Number.between(from: 0.0, to: 1.0) #=> 0.7844640543957383

# Min and Max boundaries of range are inclusive
# Keyword arguments: range
Faker::Number.within(range: 1..10) #=> 7
Faker::Number.within(range: 0.0..1.0) #=> 0.7844640543957383

Faker::Number.positive #=> 235.59238499107653

Expand Down
12 changes: 7 additions & 5 deletions lib/faker/default/number.rb
Expand Up @@ -143,7 +143,7 @@ def hexadecimal(legacy_digits = NOT_GIVEN, digits: 6)
# Produces a float given a mean and standard deviation.
#
# @param mean [Integer]
# @param standard_deviation [Integer, Float]
# @param standard_deviation [Numeric]
# @return [Float]
#
# @example
Expand All @@ -165,12 +165,13 @@ def normal(legacy_mean = NOT_GIVEN, legacy_standard_deviation = NOT_GIVEN, mean:
##
# Produces a number between two provided values. Boundaries are inclusive.
#
# @param from [Integer] The lowest number to include.
# @param to [Integer] The highest number to include.
# @return [Integer]
# @param from [Numeric] The lowest number to include.
# @param to [Numeric] The highest number to include.
# @return [Numeric]
#
# @example
# Faker::Number.between(from: 1, to: 10) #=> 7
# Faker::Number.between(from: 0.0, to: 1.0) #=> 0.7844640543957383
#
# @faker.version 1.0.0
def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 1.00, to: 5000.00)
Expand All @@ -186,10 +187,11 @@ def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 1.00, to: 5000
# Produces a number within two provided values. Boundaries are inclusive or exclusive depending on the range passed.
#
# @param range [Range] The range from which to generate a number.
# @return [Integer]
# @return [Numeric]
#
# @example
# Faker::Number.within(range: 1..10) #=> 7
# Faker::Number.within(range: 0.0..1.0) #=> 0.7844640543957383
#
# @faker.version 1.0.0
def within(legacy_range = NOT_GIVEN, range: 1.00..5000.00)
Expand Down

0 comments on commit 0e219fa

Please sign in to comment.