Sha256: e0e18570c3abe2c273eb4056c4c026e2ade3ff1fbacfca090fd31a2729b411d1
Contents?: true
Size: 796 Bytes
Versions: 3
Compression:
Stored size: 796 Bytes
Contents
require 'yaml' module LetterOpener class DeliveryMethod class InvalidOption < StandardError; end attr_accessor :settings def initialize(options = {}) raise InvalidOption, "A location option is required when using the Letter Opener delivery method" if LetterOpener.location.nil? self.settings = options end def deliver!(mail) location = File.join(LetterOpener.location, "#{Time.now.to_i}_#{Digest::SHA1.hexdigest(mail.encoded)[0..6]}") messages = Message.rendered_messages(location, mail) info = {} info[:subject] = mail.subject.to_s info[:to] = mail.to.join(',') info[:from] = mail.from.join(',') File.open(File.join(location, 'info.yml'), 'w') {|f| f.write YAML.dump(info) } messages end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
letter_opener-web-0.2.0 | lib/letter_opener/delivery_method.rb |
letter_opener-web-0.1.2 | lib/letter_opener/delivery_method.rb |
letter_opener-web-0.1.1 | lib/letter_opener/delivery_method.rb |