Parent

Methods

LetterOpener::DeliveryMethod

Attributes

settings[RW]

Public Class Methods

new(options = {}) click to toggle source
# File lib/letter_opener/delivery_method.rb, line 7
def initialize(options = {})
  raise InvalidOption, "A location option is required when using the Letter Opener delivery method" if options[:location].nil?
  self.settings = options
end

Public Instance Methods

deliver!(mail) click to toggle source
# File lib/letter_opener/delivery_method.rb, line 12
def deliver!(mail)
  location = File.join(settings[:location], "#{Time.now.to_i}_#{Digest::SHA1.hexdigest(mail.encoded)[0..6]}")
  messages = Message.rendered_messages(location, mail)
  Launchy.open(URI.parse(URI.escape(messages.first.filepath)))
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.