Class: WebmailProvider
- Inherits:
-
Object
- Object
- WebmailProvider
- Defined in:
- lib/webmail_provider.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, url) ⇒ WebmailProvider
constructor
A new instance of WebmailProvider.
Constructor Details
#initialize(name, url) ⇒ WebmailProvider
Returns a new instance of WebmailProvider.
7 8 9 10 |
# File 'lib/webmail_provider.rb', line 7 def initialize(name, url) @name = name @url = URI("https://#{url}") end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/webmail_provider.rb', line 5 def name @name end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/webmail_provider.rb', line 5 def url @url end |
Class Method Details
.for(email_address) ⇒ Object
12 13 14 15 |
# File 'lib/webmail_provider.rb', line 12 def self.for(email_address) domain = email_address && email_address.split('@').last.to_s.strip list[domain] end |
.list ⇒ Object
17 18 19 20 21 22 |
# File 'lib/webmail_provider.rb', line 17 def self.list @list ||= CSV.foreach(File.join(__dir__, 'providers.csv')) .each_with_object({}) do |(domain, *attributes), hash| hash[domain] = new(*attributes) end end |