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:
parent
ae08268c78
commit
0872d98f55
@ -69,6 +69,9 @@ Faker::Internet.domain_word
|
|||||||
Faker::Internet.domain_suffix
|
Faker::Internet.domain_suffix
|
||||||
|
|
||||||
Faker::Internet.ip_v4_address
|
Faker::Internet.ip_v4_address
|
||||||
|
|
||||||
|
Faker::Internet.url
|
||||||
|
Faker::Internet.slug
|
||||||
```
|
```
|
||||||
|
|
||||||
### Faker::Lorem
|
### Faker::Lorem
|
||||||
|
@ -46,6 +46,9 @@ puts Faker::Internet.domain_suffix
|
|||||||
|
|
||||||
puts Faker::Internet.ip_v4_address
|
puts Faker::Internet.ip_v4_address
|
||||||
|
|
||||||
|
puts Faker::Internet.url
|
||||||
|
puts Faker::Internet.slug
|
||||||
|
|
||||||
puts "\n\t### Faker::Lorem\n\n"
|
puts "\n\t### Faker::Lorem\n\n"
|
||||||
|
|
||||||
puts Faker::Lorem.words
|
puts Faker::Lorem.words
|
||||||
|
@ -44,5 +44,14 @@ module Faker
|
|||||||
(2..254).to_a.sample,
|
(2..254).to_a.sample,
|
||||||
].join('.')
|
].join('.')
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user