mirror of
https://github.com/askn/faker.git
synced 2023-08-10 21:13:01 +03:00
add number
This commit is contained in:
parent
930398a41e
commit
099dce6fc3
@ -108,6 +108,13 @@ Faker::Name.suffix
|
||||
Faker::Name.title
|
||||
```
|
||||
|
||||
### Faker::Number
|
||||
|
||||
```crystal
|
||||
Faker::Number.number(10)
|
||||
Faker::Number.digit
|
||||
```
|
||||
|
||||
### Faker::PhoneNumber
|
||||
|
||||
```crystal
|
||||
|
@ -74,6 +74,11 @@ puts Faker::Name.prefix
|
||||
puts Faker::Name.suffix
|
||||
puts Faker::Name.title
|
||||
|
||||
puts "\n\t### Faker::Number\n\n"
|
||||
|
||||
puts Faker::Number.number(10)
|
||||
puts Faker::Number.digit
|
||||
|
||||
puts "\n\t### Faker::PhoneNumber\n\n"
|
||||
|
||||
puts Faker::PhoneNumber.phone_number
|
||||
|
11
src/faker/number.cr
Normal file
11
src/faker/number.cr
Normal file
@ -0,0 +1,11 @@
|
||||
module Faker
|
||||
class Number
|
||||
def self.number(digits)
|
||||
(1..digits).map { digit }.join ""
|
||||
end
|
||||
|
||||
def self.digit
|
||||
rand(10).to_s
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user