Class: Hanami::Mailer::Delivery::Test

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/mailer/delivery/test.rb

Overview

Test delivery method that stores delivery results in memory

Since:

  • 3.0.0

Instance Method Summary collapse

Instance Method Details

#call(message) ⇒ Delivery::Result

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Deliver a message by storing a result in memory

Parameters:

  • message (Message)

    the message to deliver

Returns:

Since:

  • 3.0.0



35
36
37
38
39
# File 'lib/hanami/mailer/delivery/test.rb', line 35

def call(message)
  result = Result.new(message: message)
  deliveries << result
  result
end

#clearObject

Clear all delivery results

Since:

  • 3.0.0



25
26
27
# File 'lib/hanami/mailer/delivery/test.rb', line 25

def clear
  deliveries.clear
end

#deliveriesArray<Delivery::Result>

Returns all delivery results

Returns:

Since:

  • 3.0.0



17
18
19
# File 'lib/hanami/mailer/delivery/test.rb', line 17

def deliveries
  @deliveries ||= []
end

#preview(message) ⇒ Message

Preview a message without delivering it.

Returns the message unchanged. Delivery methods that support service-specific preview logic (e.g. resolving a template from a remote API) can override this method.

Parameters:

  • message (Message)

    the message to preview

Returns:

Since:

  • 3.0.0



51
52
53
# File 'lib/hanami/mailer/delivery/test.rb', line 51

def preview(message)
  message
end