Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update documentation to include Float type #2204

Merged
merged 2 commits into from
Feb 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/default/number.md
Original file line number Diff line number Diff line change
@@ -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

12 changes: 7 additions & 5 deletions lib/faker/default/number.rb
Original file line number Diff line number Diff line change
@@ -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
@@ -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)
@@ -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)