class Maildir

Overview

Class for generating unique file names for new messages

Included Modules

Defined in:

maildir.cr
message.cr
serializer/base.cr
serializer/json.cr
serializer/yaml.cr
unique_name.cr
version.cr

Constant Summary

DEFAULT_SERIALIZER = Maildir::Serializer::Base.new

Default serializer.

SUBDIRS = {"tmp", "new", "cur"}
VERSION = "6.0.2"

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(path, create = true) #

Create a new maildir at +path+. If +create+ is true, will ensure that the required subdirectories exist.


[View source]

Class Method Detail

def self.serializer #

Gets the default serializer.


[View source]
def self.serializer=(serializer : Maildir::Serializer::Base) #

Sets the default serializer.


[View source]

Instance Method Detail

def <=>(other) #

Compare maildirs by their paths. If maildir is a different class, return nil. Otherwise, return 1, 0, or -1.


[View source]
def add(data) #

Writes data object out as a new message. Returns a Maildir::Message. See Maildir::Message.create for more.


[View source]
def create_directories #

Ensure subdirectories exist. This can safely be called multiple times, but must hit the disk. Avoid calling this if you're certain the directories exist.


[View source]
def cur_path #

[View source]
def delete(key) #

Deletes the message for key by calling destroy() on the message.


[View source]
def get(key) #

Returns a message object for key


[View source]
def get_stale_tmp(time = Time.utc - 129600.seconds) #

Finds messages in the tmp folder that have not been modified since +time+. +time+ defaults to 36 hours ago.


[View source]
def inspect #

Friendly inspect method


[View source]
def list(dir, options = {} of Symbol => String | Int32 | Nil) #

Returns an arry of messages from :new or :cur directory, sorted by key. If options[:flags] is specified and directory is :cur, returns messages with flags specified

E.g. maildir.list(:cur, :flags => 'F') # => lists all messages with flag 'F' maildir.list(:cur, :flags => 'FS') # => lists all messages with flag 'F' and 'S'; Flags must be specified in acending ASCII order ('FS' and not 'SF') maildir.list(:cur, :flags => '') # => lists all messages without any flags This option does not work for :new directory

If options[:limit] is specified, returns only so many keys.

E.g. maildir.list(:new) # => all new messages maildir.list(:cur, :limit => 10) # => 10 oldest messages in cur


[View source]
def new_path #

[View source]
def path : String #

[View source]
def serializer #

Returns own serializer or falls back to default.


[View source]
def serializer=(serializer : Maildir::Serializer::Base | Nil) #

[View source]
def tmp_path #

define methods tmp_path, new_path, & cur_path


[View source]