Class: EasyIMAP::Folder

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_imap/folder.rb

Overview

A Folder on the IMAP server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conn, name, delim) ⇒ Folder

Creates an instance representing a folder with name, on the server connection conn, with the folder delimiter delim.

Normally this class is only instantiated internally.



11
12
13
14
15
16
# File 'lib/easy_imap/folder.rb', line 11

def initialize(conn, name, delim)
  @conn = conn
  @full_name = name
  @name = name.split(delim).last
  @delim = delim
end

Instance Attribute Details

#nameObject (readonly)

the name of the folder.



5
6
7
# File 'lib/easy_imap/folder.rb', line 5

def name
  @name
end

Instance Method Details

#foldersObject

An array of folders in this folder.



27
28
29
30
31
# File 'lib/easy_imap/folder.rb', line 27

def folders
  @conn.list("#{@full_name}#{@delim}", '%').map do |f|
    Folder.new(@conn, f.name, f.delim)
  end
end

#messagesObject

An array of messages in this folder.



19
20
21
22
23
24
# File 'lib/easy_imap/folder.rb', line 19

def messages
  @conn.examine(@full_name)
  @conn.uid_search(['ALL']).map do |uid|
    Message.new(@conn, uid)
  end
end