1
0
mirror of https://github.com/askn/faker.git synced 2023-08-10 21:13:01 +03:00

add number

This commit is contained in:
Aşkın Gedik 2016-01-06 15:16:07 +02:00
parent 930398a41e
commit 099dce6fc3
3 changed files with 23 additions and 0 deletions

View File

@ -108,6 +108,13 @@ Faker::Name.suffix
Faker::Name.title Faker::Name.title
``` ```
### Faker::Number
```crystal
Faker::Number.number(10)
Faker::Number.digit
```
### Faker::PhoneNumber ### Faker::PhoneNumber
```crystal ```crystal

View File

@ -74,6 +74,11 @@ puts Faker::Name.prefix
puts Faker::Name.suffix puts Faker::Name.suffix
puts Faker::Name.title 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 "\n\t### Faker::PhoneNumber\n\n"
puts Faker::PhoneNumber.phone_number puts Faker::PhoneNumber.phone_number

11
src/faker/number.cr Normal file
View 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