class Luggage::MailboxArray

Attributes

connection[R]

Public Class Methods

new(connection) click to toggle source
# File lib/luggage/mailbox_array.rb, line 5
def initialize(connection)
  @connection = connection
end

Public Instance Methods

[](*args, &block) click to toggle source
Calls superclass method
# File lib/luggage/mailbox_array.rb, line 9
def [](*args, &block)
  mailbox_name = Luggage::Mailbox.convert_mailbox_name(args.first)

  if mailbox_name
    mailbox(mailbox_name, &block)
  else
    super
  end
end
host() click to toggle source
# File lib/luggage/mailbox_array.rb, line 27
def host
  connection.instance_variable_get(:@host)
end
inspect() click to toggle source
# File lib/luggage/mailbox_array.rb, line 23
def inspect
  mailboxes.inspect
end
method_missing(meth, *args, &block) click to toggle source
# File lib/luggage/mailbox_array.rb, line 19
def method_missing(meth, *args, &block)
  mailboxes.send(meth, *args, &block)
end

Private Instance Methods

mailbox(name, &block) click to toggle source

Cosntructs a Mailbox

`name` should be a string describing the Imap mailbox's name

# File lib/luggage/mailbox_array.rb, line 37
def mailbox(name, &block)
  Mailbox.new(connection, name, &block)
end
mailboxes() click to toggle source
# File lib/luggage/mailbox_array.rb, line 41
def mailboxes
  connection.list("", "*").map do |result|
    Mailbox.new(connection, result.name)
  end
end