Sha256: 147c850abfe4c73c6c476fac79d5ea403cfd06f8fd509fec403cc9d56d241289
Contents?: true
Size: 932 Bytes
Versions: 1
Compression:
Stored size: 932 Bytes
Contents
require "mailbin/version" require "mailbin/engine" module Mailbin autoload :DeliveryMethod, "mailbin/delivery_method" autoload :InlinePreviewInterceptor, "mailbin/inline_preview_interceptor" class << self def all Dir.glob("*.eml", base: settings[:location]).map do |message_id| find(message_id) end.sort_by(&:date).reverse! end def find(message_id) InlinePreviewInterceptor.previewing_email Mail.read(location_for(message_id)) end def destroy(message_id) File.delete location_for(message_id) end def destroy_all Dir.glob("*.eml", base: settings[:location]).map do |message_id| destroy(message_id) end end def location_for(message_id) message_id += ".eml" unless message_id.end_with?(".eml") File.join(settings[:location], message_id) end def settings ActionMailer::Base.mailbin_settings end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mailbin-0.1.0 | lib/mailbin.rb |