class

Maildir::Message

Inherits Comparable / Reference / Object

Constants

COLON = ":"

COLON seperates the unique name from the info

FLAG_NAMES = { passed: "P", replied: "R", seen: "S", trashed: "T", draft: "D", flagged: "F", }

The standard maildir flags, and the letters representing them.

INFO = "2,"

The default info, to which flags are appended

Constructors

new(maildir : Maildir, key : String | Nil = nil)

Create a new, unwritten message or instantiate an existing message. If key is nil, create a new message: Message.new(maildir) # => a new, unwritten message

If +key+ is not nil, instantiate a message object for the message at +key+. Message.new(maildir, key) # => an existing message

Source

Class methods

create(maildir, data)

Create a new message in maildir with data. The message is first written to the tmp dir, then moved to new. This is a shortcut for: message = Maildir::Message.new(maildir) message.write(data)

Source
parse_key(key : String) : Tuple(String, String, String | Nil)

Splits a key into its dir, unique name, and info parts. Raises ArgumentError if the key is not of the form "dir/unique_name[:info]".

Source
serializer

DEPRECATED: Get the serializer. @see Maildir.serializer

Source
serializer=(serializer)

DEPRECATED: Set the serializer. @see Maildir.serializer=

Source

Instance methods

<=>(other : self)

Compares messages by their paths. Returns 1, 0, or -1.

Source
add_flag(flag)

Adds one or more flags to a message. Returns the message's key if successful, false otherwise.

flag:: String or Enumerable of flags

Source
data

Returns the message's data from disk. If the path doesn't exist, raises File::NotFoundError.

Source
destroy

Deletes the message path. Returns nil if the file was destroyed, false if the file was missing.

Source
draft!

Adds the "D" (draft) flag to the message. Returns the message's key if successful, false otherwise.

Source
draft?

Returns true if the message carries the "D" (draft) flag.

Source
filename

Returns the filename of the message

Source
flagged!

Adds the "F" (flagged) flag to the message. Returns the message's key if successful, false otherwise.

Source
flagged?

Returns true if the message carries the "F" (flagged) flag.

Source
flags

Returns an array of single letter flags applied to the message

Source
flags=(flags)

Sets the flags on a message. Returns the message's key if successful, false otherwise.

flags:: String or Enumerable of flags

Source
hash(hasher)

See Object#hash(hasher)

Source
info
Source
info=(info)

Set info on a message. Returns the message's key if successful, false otherwise.

Source
inspect(io : IO) : Nil

Friendly inspect method

Source
key

Returns the key to identify the message

Source
mtime

Returns the message's mtime, or false if the file doesn't exist.

Source
passed!

Adds the "P" (passed) flag to the message. Returns the message's key if successful, false otherwise.

Source
passed?

Returns true if the message carries the "P" (passed) flag.

Source
path

Returns the full path to the message

Source
process

Move a message from new to cur, add info. Returns the message's key

Source
remove_flag(flags)

Removes flags from a message. Returns the message's key if successful, false otherwise.

flags:: String or Enumerable of flags

Source
replied!

Adds the "R" (replied) flag to the message. Returns the message's key if successful, false otherwise.

Source
replied?

Returns true if the message carries the "R" (replied) flag.

Source
seen!

Adds the "S" (seen) flag to the message. Returns the message's key if successful, false otherwise.

Source
seen?

Returns true if the message carries the "S" (seen) flag.

Source
serializer

Helper to get serializer.

Source
trashed!

Adds the "T" (trashed) flag to the message. Returns the message's key if successful, false otherwise.

Source
trashed?

Returns true if the message carries the "T" (trashed) flag.

Source
unique_name
Source
utime(atime, mtime)

Updates the modification and access time. Returns nil if successful, false if the file doesn't exist.

Source
write(data)

Writes data to disk. Can only be called on messages instantiated without a key (which haven't been written to disk). After successfully writing to disk, rename the message to the new dir

Returns the message's key

Source