Sha256: 604ea20230a65dfccc38fdbef9b886a4b9a22c409dcb7e96a62be0edf47752d0
Contents?: true
Size: 776 Bytes
Versions: 6
Compression:
Stored size: 776 Bytes
Contents
require 'fileutils' module Culerity module PersistentDelivery DELIVERIES_PATH = File.join(RAILS_ROOT, 'tmp', 'action_mailer_acceptance_deliveries.cache') def self.included(base) base.class_eval do def self.deliveries return [] unless File.exist?(DELIVERIES_PATH) File.open(DELIVERIES_PATH,'r') do |f| Marshal.load(f) end end def self.clear_deliveries FileUtils.rm_f DELIVERIES_PATH end end end def perform_delivery_persistent(mail) deliveries << mail File.open(DELIVERIES_PATH,'w') do |f| f << Marshal.dump(deliveries) end end end end ActionMailer::Base.send :include, Culerity::PersistentDelivery
Version data entries
6 entries across 6 versions & 2 rubygems