Sha256: 5cb04b733bcde3e544767164a8dbec70cd6dd9b208b63f259f0169d8df0f89e2
Contents?: true
Size: 1.16 KB
Versions: 4
Compression:
Stored size: 1.16 KB
Contents
module Luggage class MailboxArray attr_reader :connection def initialize(connection) @connection = connection end def [](*args, &block) case args.first when String mailbox(args.first, &block) when :inbox, :spam, :sent, :trash mailbox(args.first.to_s.upcase, &block) when :g_all mailbox("[Gmail]/All Mail", &block) when :g_sent mailbox("[Gmail]/Sent", &block) when :g_trash mailbox("[Gmail]/Trash", &block) when Symbol mailbox(args.first, &block) when nil mailboxes else super end end def method_missing(meth, *args, &block) mailboxes.send(meth, *args, &block) end def inspect mailboxes.inspect end def host connection.instance_variable_get(:@host) end private # Cosntructs a Mailbox # # `name` should be a string describing the Imap mailbox's name # def mailbox(name, &block) Mailbox.new(connection, name, &block) end def mailboxes connection.list("", "*").map do |result| Mailbox.new(connection, result.name) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
luggage-1.1.2 | lib/luggage/mailbox_array.rb |
luggage-1.1.1 | lib/luggage/mailbox_array.rb |
luggage-1.1.0 | lib/luggage/mailbox_array.rb |
luggage-1.0.0 | lib/luggage/mailbox_array.rb |