Class: MailInterceptor::Interceptor

Inherits:
Object
  • Object
show all
Defined in:
lib/mail_interceptor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Interceptor



7
8
9
10
11
12
13
# File 'lib/mail_interceptor.rb', line 7

def initialize options = {}
  @deliver_emails_to = Array.wrap options[:deliver_emails_to]
  @subject_prefix    = options[:subject_prefix] || ''
  @forward_emails_to = options.fetch :forward_emails_to

  sanitize_forward_emails_to
end

Instance Attribute Details

#deliver_emails_toObject

Returns the value of attribute deliver_emails_to.



5
6
7
# File 'lib/mail_interceptor.rb', line 5

def deliver_emails_to
  @deliver_emails_to
end

#forward_emails_toObject

Returns the value of attribute forward_emails_to.



5
6
7
# File 'lib/mail_interceptor.rb', line 5

def forward_emails_to
  @forward_emails_to
end

#subject_prefixObject

Returns the value of attribute subject_prefix.



5
6
7
# File 'lib/mail_interceptor.rb', line 5

def subject_prefix
  @subject_prefix
end

Instance Method Details

#delivering_email(message) ⇒ Object



15
16
17
18
19
# File 'lib/mail_interceptor.rb', line 15

def delivering_email message
  add_env_info_to_subject_prefix
  add_subject_prefix message
  message.to = normalize_recipients(message.to).flatten.uniq
end