lib/faker/internet.rb in faker19-1.0.2 vs lib/faker/internet.rb in faker19-1.0.3
- old
+ new
@@ -1,25 +1,25 @@
module Faker
class Internet < Base
class << self
- def email(name = nil)
- [ user_name(name), domain_name ].join('@')
+ def email(name = nil, name_suffix = "")
+ [ user_name(name, name_suffix), domain_name ].join('@')
end
- def free_email(name = nil)
- [ user_name(name), fetch('internet.free_email') ].join('@')
+ def free_email(name = nil, name_suffix = "")
+ [ user_name(name, name_suffix), fetch('internet.free_email') ].join('@')
end
- def user_name(name = nil)
- return name.scan(/\w+/).shuffle.join(%w(. _).rand).downcase if name
+ def user_name(name = nil, name_suffix = "")
+ return name.scan(/\w+/).shuffle.join(%w(. _).rand).downcase + name_suffix.to_s if name
[
- Proc.new { Name.first_name.gsub(/\W/, '').downcase },
+ Proc.new { Name.first_name.gsub(/\W/, '').downcase + name_suffix.to_s },
Proc.new {
[ Name.first_name, Name.last_name ].map {|n|
n.gsub(/\W/, '')
- }.join(%w(. _).rand).downcase }
+ }.join(%w(. _).rand).downcase + name_suffix.to_s }
].rand.call
end
def domain_name
[ domain_word, domain_suffix ].join('.')
@@ -56,6 +56,6 @@
hex_ary.rand + hex_ary.rand,
hex_ary.rand + hex_ary.rand].join(':')
end
end
end
-end
+end
\ No newline at end of file