Class: Mail::Notify::Personalisation

Inherits:
Object
  • Object
show all
Defined in:
lib/mail/notify/personalisation.rb

Constant Summary collapse

BLANK =
Object.new

Instance Method Summary collapse

Constructor Details

#initialize(mail) ⇒ Personalisation

Returns a new instance of Personalisation.



8
9
10
11
12
# File 'lib/mail/notify/personalisation.rb', line 8

def initialize(mail)
  @body = mail.body.raw_source
  @subject = mail.subject
  @personalisation = mail[:personalisation]&.unparsed_value || {}
end

Instance Method Details

#to_hObject



14
15
16
17
18
# File 'lib/mail/notify/personalisation.rb', line 14

def to_h
  merged_options
    .reject { |_k, v| v.blank? }
    .transform_values { |value| value == BLANK ? "" : value }
end