Module: Emagen
- Defined in:
- lib/emagen.rb,
lib/emagen/version.rb,
lib/emagen/web_address.rb
Defined Under Namespace
Classes: WebAddress
Constant Summary collapse
- VERSION =
"0.0.3"
Class Method Summary collapse
Class Method Details
.for(name, web_address) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/emagen.rb', line 5 def for(name, web_address) domain = WebAddress.new(web_address).domain first_name, last_name = name.split first_initial, last_initial = first_name[0], last_name[0] patterns = %w{ fn ln fnln fn.ln filn fi.ln fnli fn.li fili fi.li lnfn ln.fn lnfi ln.fi lifn li.fn lifi li.fi fn-ln fi-ln fn-li fi-li ln-fn ln-fi li-fi fn_ln fi_ln fn_li fi_li ln_fn ln_fi li_fi } patterns.map do |pattern| email_username = pattern .gsub('fn', first_name) .gsub('ln', last_name) .gsub('fi', first_initial) .gsub('li', last_initial) "#{email_username}@#{domain}" end end |