class Maildir
- Maildir
- Reference
- Object
Overview
Class for generating unique file names for new messages
Included Modules
- Comparable(Maildir)
Defined in:
maildir.crmessage.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
-
.new(path, create = true)
Create a new maildir at +path+.
Class Method Summary
-
.serializer
Gets the default serializer.
-
.serializer=(serializer : Maildir::Serializer::Base)
Sets the default serializer.
Instance Method Summary
-
#<=>(other)
Compare maildirs by their paths.
-
#add(data)
Writes data object out as a new message.
-
#create_directories
Ensure subdirectories exist.
- #cur_path
-
#delete(key)
Deletes the message for key by calling destroy() on the message.
-
#get(key)
Returns a message object for key
-
#get_stale_tmp(time = Time.utc - 129600.seconds)
Finds messages in the tmp folder that have not been modified since +time+.
-
#inspect
Friendly inspect method
-
#list(dir, options = {} of Symbol => String | Int32 | Nil)
Returns an arry of messages from :new or :cur directory, sorted by key.
- #new_path
- #path : String
-
#serializer
Returns own serializer or falls back to default.
- #serializer=(serializer : Maildir::Serializer::Base | Nil)
-
#tmp_path
define methods tmp_path, new_path, & cur_path
Constructor Detail
Create a new maildir at +path+. If +create+ is true, will ensure that the required subdirectories exist.
Class Method Detail
Instance Method Detail
Compare maildirs by their paths. If maildir is a different class, return nil. Otherwise, return 1, 0, or -1.
Writes data object out as a new message. Returns a Maildir::Message. See Maildir::Message.create for more.
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.
Finds messages in the tmp folder that have not been modified since +time+. +time+ defaults to 36 hours ago.
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