Class: Smailer::Models::MailKey
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Smailer::Models::MailKey
- Defined in:
- lib/smailer/models/mail_key.rb
Class Method Summary collapse
Class Method Details
.extract_email(email) ⇒ Object
32 33 34 35 |
# File 'lib/smailer/models/mail_key.rb', line 32 def self.extract_email(email) email = $1.strip if email =~ /<(.+@.+)>\s*$/ email end |
.generate(email) ⇒ Object
18 19 20 |
# File 'lib/smailer/models/mail_key.rb', line 18 def self.generate(email) Digest::MD5.hexdigest("The #{email} and our great secret, which lies in Mt. Asgard!") end |
.get(email) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/smailer/models/mail_key.rb', line 22 def self.get(email) email = extract_email(email) key = generate(email) stored = find_by_key(key) create :email => email, :key => key unless stored key end |