class Maildir::Message
- Maildir::Message
- Reference
- Object
Included Modules
- Comparable(Maildir::Message)
Defined in:
message.crConstant Summary
-
COLON =
":"
-
COLON seperates the unique name from the info
-
FLAG_NAMES =
{passed: "P", replied: "R", seen: "S", trashed: "T", draft: "D", flagged: "F"}
-
INFO =
"2,"
-
The default info, to which flags are appended
Constructors
-
.new(maildir : Maildir, key = nil)
Create a new, unwritten message or instantiate an existing message.
Class Method Summary
-
.create(maildir, data)
Create a new message in maildir with data.
-
.serializer
DEPRECATED Get the serializer.
-
.serializer=(serializer)
DEPRECATED Set the serializer.
Instance Method Summary
-
#<=>(other)
Compares messages by their paths.
-
#add_flag(flag)
Adds a flag to a message.
-
#atime
Returns the message's atime, or false if the file doesn't exist.
-
#data
Returns the message's data from disk.
-
#destroy
Deletes the message path and freezes the message object.
- #dir : String?
- #draft!
- #draft?
-
#filename
Returns the filename of the message
- #flagged!
- #flagged?
-
#flags
Returns an array of single letter flags applied to the message
-
#flags=(flags)
Sets the flags on a message.
- #info : String?
-
#info=(info)
Set info on a message.
-
#inspect
Friendly inspect method
-
#key
Returns the key to identify the message
-
#mtime
Returns the message's mtime, or false if the file doesn't exist.
- #passed!
- #passed?
-
#path
Returns the full path to the message
-
#process
Move a message from new to cur, add info.
-
#remove_flag(flags)
Removes flags from a message.
- #replied!
- #replied?
- #seen!
- #seen?
-
#serializer
Helper to get serializer.
- #trashed!
- #trashed?
- #unique_name : String?
-
#utime(atime, mtime)
Updates the modification and access time.
-
#write(data)
Writes data to disk.
Constructor Detail
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
Class Method Detail
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)
Instance Method Detail
Compares messages by their paths. If message is a different class, return nil. Otherwise, return 1, 0, or -1.
Adds a flag to a message. Returns the message's key if successful, false otherwise.
Returns the message's data from disk. If the path doesn't exist, freeze's the object and raises Errno:ENOENT
Deletes the message path and freezes the message object. Returns 1 if the file was destroyed, false if the file was missings.
Sets the flags on a message. Returns the message's key if successful, false otherwise.
Removes flags from a message. Returns the message's key if successful, false otherwise.
flags:: String or Array
Updates the modification and access time. Returns 1 if successful, false otherwise.
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