Class: LetterThief::DeliveryMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/letter_thief/delivery_method.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ DeliveryMethod

Returns a new instance of DeliveryMethod.



5
6
# File 'lib/letter_thief/delivery_method.rb', line 5

def initialize(options = {})
end

Instance Method Details

#deliver!(mail) ⇒ Object

this is not really true, we don’t know if it’s the last email, but for the moment this should do.



9
10
11
12
13
14
# File 'lib/letter_thief/delivery_method.rb', line 9

def deliver!(mail)
  require "launchy"
  ::Launchy.open(LetterThief::Engine.routes.url_helpers.email_message_url(LetterThief::EmailMessage.last, Rails.configuration.action_mailer.default_url_options))
rescue LoadError
  puts "WARNING: LetterThief requires the 'launchy' gem to open the email in a web browser. Add it to your Gemfile."
end