Class: Mailmate::MailboxGraph
- Inherits:
-
Object
- Object
- Mailmate::MailboxGraph
- Defined in:
- lib/mailmate/mailbox_graph.rb
Constant Summary collapse
- APP_RESOURCES =
"/Applications/MailMate.app/Contents/Resources"- SPECIAL_UUIDS =
%w[ALL_MESSAGES INBOX SENT DRAFTS ARCHIVE JUNK TRASH FLAGGED MAILBOXES PERSONAL_INBOX].freeze
Instance Attribute Summary collapse
-
#by_name ⇒ Object
readonly
Mailbox = a Hash with keys: :uuid, :name, :parent, :set, :filter.
-
#by_uuid ⇒ Object
readonly
Mailbox = a Hash with keys: :uuid, :name, :parent, :set, :filter.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ MailboxGraph
constructor
A new instance of MailboxGraph.
- #load! ⇒ Object
- #lookup(name_or_uuid) ⇒ Object
Constructor Details
#initialize ⇒ MailboxGraph
Returns a new instance of MailboxGraph.
23 24 25 26 |
# File 'lib/mailmate/mailbox_graph.rb', line 23 def initialize @by_uuid = {} @by_name = {} end |
Instance Attribute Details
#by_name ⇒ Object (readonly)
Mailbox = a Hash with keys: :uuid, :name, :parent, :set, :filter
17 18 19 |
# File 'lib/mailmate/mailbox_graph.rb', line 17 def by_name @by_name end |
#by_uuid ⇒ Object (readonly)
Mailbox = a Hash with keys: :uuid, :name, :parent, :set, :filter
17 18 19 |
# File 'lib/mailmate/mailbox_graph.rb', line 17 def by_uuid @by_uuid end |
Class Method Details
.load ⇒ Object
19 20 21 |
# File 'lib/mailmate/mailbox_graph.rb', line 19 def self.load new.tap(&:load!) end |
Instance Method Details
#load! ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/mailmate/mailbox_graph.rb', line 28 def load! load_plist!("#{APP_RESOURCES}/standardMailboxes.plist") load_plist!("#{APP_RESOURCES}/defaultMailboxes.plist") load_plist!(Mailmate.config.mailboxes_plist) build_name_index! self end |
#lookup(name_or_uuid) ⇒ Object
36 37 38 |
# File 'lib/mailmate/mailbox_graph.rb', line 36 def lookup(name_or_uuid) @by_uuid[name_or_uuid] || @by_name[name_or_uuid] end |