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

Returns a new instance of Interceptor.



9
10
11
12
13
14
15
16
# File 'lib/mail_interceptor.rb', line 9

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

  add_env_info_to_subject_prefix
  sanitize_forward_emails_to
end

Instance Attribute Details

#deliver_emails_toObject

Returns the value of attribute deliver_emails_to.



7
8
9
# File 'lib/mail_interceptor.rb', line 7

def deliver_emails_to
  @deliver_emails_to
end

#forward_emails_toObject

Returns the value of attribute forward_emails_to.



7
8
9
# File 'lib/mail_interceptor.rb', line 7

def forward_emails_to
  @forward_emails_to
end

#subject_prefixObject

Returns the value of attribute subject_prefix.



7
8
9
# File 'lib/mail_interceptor.rb', line 7

def subject_prefix
  @subject_prefix
end

Instance Method Details

#delivering_email(message) ⇒ Object



18
19
20
21
# File 'lib/mail_interceptor.rb', line 18

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