class Coppertone::SenderIdentity

A consolidated sender identity, suitable for use with an SPF request. Parses the identity and ensures validity. Also has accessor methods for the macro letters.

Constants

DEFAULT_LOCALPART
EMAIL_ADDRESS_SPLIT_REGEXP

Attributes

domain[R]
l[R]
localpart[R]
o[R]
s[R]
sender[R]

Public Class Methods

new(sender) click to toggle source
# File lib/coppertone/sender_identity.rb, line 11
def initialize(sender)
  @sender = sender
  initialize_localpart_and_domain
end

Private Instance Methods

initialize_domain(matches) click to toggle source
# File lib/coppertone/sender_identity.rb, line 28
def initialize_domain(matches)
  domain_candidate = matches[2] if matches
  @domain =
    domain_candidate.blank? ? sender : domain_candidate
end
initialize_localpart(matches) click to toggle source
# File lib/coppertone/sender_identity.rb, line 22
def initialize_localpart(matches)
  localpart_candidate = matches[1] if matches
  @localpart =
    localpart_candidate.blank? ? DEFAULT_LOCALPART : localpart_candidate
end
initialize_localpart_and_domain() click to toggle source
# File lib/coppertone/sender_identity.rb, line 34
def initialize_localpart_and_domain
  matches = EMAIL_ADDRESS_SPLIT_REGEXP.match(sender)
  initialize_localpart(matches)
  initialize_domain(matches)
end