class IMAPProcessor::Cleanse

Cleanse removes old messages from your IMAP mailboxes so you don’t have to!

aka part one of my Plan for Total Email Domination.

Cleanse doesn’t remove messages you haven’t read nor messages you’ve flagged.

Public Class Methods

new(options) click to toggle source

Creates a new Cleanse from options.

Options include:

+:Age+:: Delete messages older than this many days ago

and all options from IMAPClient

Calls superclass method IMAPProcessor::Client::new
# File lib/imap_processor/cleanse.rb, line 22
def initialize(options)
  super

  @cleanse = options[:cleanse]
  @boxes = @cleanse.keys
end
process_args(args) click to toggle source
Calls superclass method IMAPProcessor::process_args
# File lib/imap_processor/cleanse.rb, line 29
  def self.process_args(args)
    super __FILE__, args, {} do |opts, options|
      opts.banner << <<-EOF
imap_cleanse removes old messages from your IMAP mailboxes.
      EOF
    end
  end

Public Instance Methods

run() click to toggle source

Removes read, unflagged messages from all selected mailboxes…

Calls superclass method IMAPProcessor::Client#run
# File lib/imap_processor/cleanse.rb, line 40
def run
  super "Cleansing read, unflagged old messages",
        [:Deleted] do
    @imap.expunge
    log "Expunged deleted messages"
  end
end