mirror of
https://github.com/askn/faker.git
synced 2023-08-10 21:13:01 +03:00
add decimal
This commit is contained in:
parent
d0044abb6d
commit
7d8998e74d
@ -125,6 +125,8 @@ Faker::Name.title
|
|||||||
|
|
||||||
```crystal
|
```crystal
|
||||||
Faker::Number.number(10)
|
Faker::Number.number(10)
|
||||||
|
Faker::Number.decimal(2)
|
||||||
|
Faker::Number.decimal(2, 3)
|
||||||
Faker::Number.digit
|
Faker::Number.digit
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -91,6 +91,8 @@ puts Faker::Name.title
|
|||||||
puts "\n\t### Faker::Number\n\n"
|
puts "\n\t### Faker::Number\n\n"
|
||||||
|
|
||||||
puts Faker::Number.number(10)
|
puts Faker::Number.number(10)
|
||||||
|
puts Faker::Number.decimal(2)
|
||||||
|
puts Faker::Number.decimal(2, 3)
|
||||||
puts Faker::Number.digit
|
puts Faker::Number.digit
|
||||||
|
|
||||||
puts "\n\t### Faker::PhoneNumber\n\n"
|
puts "\n\t### Faker::PhoneNumber\n\n"
|
||||||
|
@ -7,5 +7,11 @@ module Faker
|
|||||||
def self.digit
|
def self.digit
|
||||||
rand(10).to_s
|
rand(10).to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.decimal(l_digits, r_digits = 2)
|
||||||
|
l_d = number(l_digits)
|
||||||
|
r_d = number(r_digits)
|
||||||
|
"#{l_d}.#{r_d}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user