Module: Courrier::Email::Address
- Defined in:
- lib/courrier/email/address.rb
Class Method Summary collapse
- .email_address_with_name ⇒ Object
- .email_with_name(email, name) ⇒ Object
- .with_name(address, name) ⇒ Object
Class Method Details
.email_address_with_name ⇒ Object
33 |
# File 'lib/courrier/email/address.rb', line 33 def email_with_name(email, name) = Address.with_name(email, name) |
.email_with_name(email, name) ⇒ Object
32 |
# File 'lib/courrier/email/address.rb', line 32 def email_with_name(email, name) = Address.with_name(email, name) |
.with_name(address, name) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/courrier/email/address.rb', line 7 def with_name(address, name) raise Courrier::ArgumentError, "Both `address` and `name` are required" if address.nil? || name.nil? raise Courrier::ArgumentError, "Both `address` and `name` must not be empty" if address.empty? || name.empty? address = address.gsub(/[<>]/, "") formatted_name = format_display_for(name) "#{formatted_name} <#{address}>" end |