Class: Premailer::Rails::Hook

Inherits:
Object
  • Object
show all
Defined in:
lib/premailer/rails/hook.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ Hook

Returns a new instance of Hook.



16
17
18
# File 'lib/premailer/rails/hook.rb', line 16

def initialize(message)
  @message = message
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



4
5
6
# File 'lib/premailer/rails/hook.rb', line 4

def message
  @message
end

Class Method Details

.delivering_emailObject



12
13
14
15
# File 'lib/premailer/rails/hook.rb', line 12

def perform(message)
  new(message).perform
  message
end

.perform(message) ⇒ Object



7
8
9
10
# File 'lib/premailer/rails/hook.rb', line 7

def perform(message)
  new(message).perform
  message
end

.previewing_emailObject



13
14
15
16
# File 'lib/premailer/rails/hook.rb', line 13

def perform(message)
  new(message).perform
  message
end

Instance Method Details

#performObject



20
21
22
23
24
25
26
# File 'lib/premailer/rails/hook.rb', line 20

def perform
  if skip_premailer_header_present?
    remove_skip_premailer_header
  elsif message_contains_html?
    replace_html_part(generate_html_part_replacement)
  end
end