Module: FFaker::Number
Instance Method Summary collapse
- #between(from: 1.00, to: 5000.00) ⇒ Object
- #decimal(whole_digits: 1, fractional_digits: 1) ⇒ Object
- #number(digits: 1) ⇒ Object
Methods included from ModuleUtils
const_missing, k, luhn_check, underscore, unique
Methods included from RandomUtils
#fetch_sample, #rand, #shuffle
Instance Method Details
#between(from: 1.00, to: 5000.00) ⇒ Object
18 19 20 |
# File 'lib/ffaker/number.rb', line 18 def between(from: 1.00, to: 5000.00) fetch_sample(from..to) end |
#decimal(whole_digits: 1, fractional_digits: 1) ⇒ Object
12 13 14 15 16 |
# File 'lib/ffaker/number.rb', line 12 def decimal(whole_digits: 1, fractional_digits: 1) whole_part_pattern = generate_pattern(whole_digits) fractional_part_pattern = generate_pattern(fractional_digits).reverse FFaker.numerify("#{whole_part_pattern}.#{fractional_part_pattern}").to_f end |