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

add slug and url

This commit is contained in:
Aşkın Gedik 2016-01-06 16:01:56 +02:00
parent ae08268c78
commit 0872d98f55
3 changed files with 15 additions and 0 deletions

View File

@ -69,6 +69,9 @@ Faker::Internet.domain_word
Faker::Internet.domain_suffix
Faker::Internet.ip_v4_address
Faker::Internet.url
Faker::Internet.slug
```
### Faker::Lorem

View File

@ -46,6 +46,9 @@ puts Faker::Internet.domain_suffix
puts Faker::Internet.ip_v4_address
puts Faker::Internet.url
puts Faker::Internet.slug
puts "\n\t### Faker::Lorem\n\n"
puts Faker::Lorem.words

View File

@ -44,5 +44,14 @@ module Faker
(2..254).to_a.sample,
].join('.')
end
def self.url
"http://#{domain_name}/#{user_name}"
end
def self.slug(words = nil, glue = nil)
glue ||= %w(- _ .).sample
(words || Lorem.words(2).join(' ')).gsub(' ', glue).downcase
end
end
end