Sha256: 30b597cd9b1e76258b5dcc7e8e3a39ca74d5a8526c168700c5aff1fbc28fc6a8
Contents?: true
Size: 802 Bytes
Versions: 2
Compression:
Stored size: 802 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 if defined?(ActionMailer)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
culerity-0.2.12 | lib/culerity/persistent_delivery.rb |
culerity-0.2.10 | lib/culerity/persistent_delivery.rb |