Class: Mailmate::MailboxGraph

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMailboxGraph

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_nameObject (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_uuidObject (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

.loadObject



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