Class: Flare::Mail
- Inherits:
-
Object
- Object
- Flare::Mail
- Defined in:
- lib/flare/mail.rb
Class Method Summary collapse
-
.domain(string) ⇒ Object
Attempts to parse an email string to get the domain from it.
-
.parsed(string) ⇒ Object
Parses a string into a Address object or returns nil if it’s invalid.
Class Method Details
.domain(string) ⇒ Object
Attempts to parse an email string to get the domain from it.
16 17 18 |
# File 'lib/flare/mail.rb', line 16 def self.domain(string) parsed(string)&.domain end |
.parsed(string) ⇒ Object
Parses a string into a Address object or returns nil if it’s invalid.
7 8 9 10 11 |
# File 'lib/flare/mail.rb', line 7 def self.parsed(string) ::Mail::Address.new(string) rescue ::Mail::Field::ParseError => error nil end |