Class: Imap::Backup::Account::Folder
- Inherits:
-
Object
- Object
- Imap::Backup::Account::Folder
- Extended by:
- Forwardable
- Defined in:
- lib/imap/backup/account/folder.rb
Constant Summary collapse
- REQUESTED_ATTRIBUTES =
["RFC822", "FLAGS", "INTERNALDATE"]
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #fetch(uid) ⇒ Object
- #folder ⇒ Object
-
#initialize(connection, name) ⇒ Folder
constructor
A new instance of Folder.
- #uids ⇒ Object
Constructor Details
#initialize(connection, name) ⇒ Folder
Returns a new instance of Folder.
16 17 18 19 |
# File 'lib/imap/backup/account/folder.rb', line 16 def initialize(connection, name) @connection = connection @name = name end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
11 12 13 |
# File 'lib/imap/backup/account/folder.rb', line 11 def connection @connection end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/imap/backup/account/folder.rb', line 12 def name @name end |
Instance Method Details
#fetch(uid) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/imap/backup/account/folder.rb', line 33 def fetch(uid) imap.examine(name) fetch_data_items = imap.uid_fetch([uid.to_i], REQUESTED_ATTRIBUTES) return nil if fetch_data_items.nil? fetch_data_item = fetch_data_items[0] attributes = fetch_data_item.attr attributes["RFC822"].force_encoding("utf-8") attributes rescue Net::IMAP::NoResponseError => e Imap::Backup.logger.warn "Folder '#{name}' does not exist" nil end |
#folder ⇒ Object
21 22 23 |
# File 'lib/imap/backup/account/folder.rb', line 21 def folder name end |