Class: Postmortem::Adapters::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/postmortem/adapters/base.rb

Overview

Base interface implementation for all Postmortem adapters.

Direct Known Subclasses

ActionMailer, Mail, Pony

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Base

Returns a new instance of Base.



9
10
11
12
# File 'lib/postmortem/adapters/base.rb', line 9

def initialize(data)
  @data = data
  @adapted = adapted
end

Instance Method Details

#html_bodyObject



32
33
34
# File 'lib/postmortem/adapters/base.rb', line 32

def html_body
  @adapted[:html_body].to_s
end

#html_body=(val) ⇒ Object



14
15
16
# File 'lib/postmortem/adapters/base.rb', line 14

def html_body=(val)
  @adapted[:html_body] = val
end

#idObject



22
23
24
# File 'lib/postmortem/adapters/base.rb', line 22

def id
  @id ||= SecureRandom.uuid
end

#serializableObject



18
19
20
# File 'lib/postmortem/adapters/base.rb', line 18

def serializable
  (%i[id] + FIELDS).to_h { |field| [camelize(field.to_s), public_send(field)] }
end

#text_bodyObject



36
37
38
# File 'lib/postmortem/adapters/base.rb', line 36

def text_body
  @adapted[:text_body].to_s
end