Class: Imap::Backup::Serializer::Message
- Inherits:
-
Object
- Object
- Imap::Backup::Serializer::Message
- Defined in:
- lib/imap/backup/serializer/message.rb
Instance Attribute Summary collapse
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#mbox ⇒ Object
readonly
Returns the value of attribute mbox.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#uid ⇒ Object
Returns the value of attribute uid.
Instance Method Summary collapse
- #body ⇒ Object
- #date ⇒ Object
- #imap_body ⇒ Object
-
#initialize(uid:, offset:, length:, mbox:, flags: []) ⇒ Message
constructor
TODO: delegate to Mboxrd::Message.
- #message ⇒ Object
- #subject ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(uid:, offset:, length:, mbox:, flags: []) ⇒ Message
TODO: delegate to Mboxrd::Message
13 14 15 16 17 18 19 |
# File 'lib/imap/backup/serializer/message.rb', line 13 def initialize(uid:, offset:, length:, mbox:, flags: []) @uid = uid @offset = offset @length = length @mbox = mbox @flags = flags.map(&:to_sym) end |
Instance Attribute Details
#flags ⇒ Object
Returns the value of attribute flags.
6 7 8 |
# File 'lib/imap/backup/serializer/message.rb', line 6 def flags @flags end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
8 9 10 |
# File 'lib/imap/backup/serializer/message.rb', line 8 def length @length end |
#mbox ⇒ Object (readonly)
Returns the value of attribute mbox.
9 10 11 |
# File 'lib/imap/backup/serializer/message.rb', line 9 def mbox @mbox end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
7 8 9 |
# File 'lib/imap/backup/serializer/message.rb', line 7 def offset @offset end |
#uid ⇒ Object
Returns the value of attribute uid.
5 6 7 |
# File 'lib/imap/backup/serializer/message.rb', line 5 def uid @uid end |
Instance Method Details
#body ⇒ Object
38 39 40 |
# File 'lib/imap/backup/serializer/message.rb', line 38 def body @body ||= .supplied_body end |
#date ⇒ Object
46 47 48 |
# File 'lib/imap/backup/serializer/message.rb', line 46 def date @date ||= .date end |
#imap_body ⇒ Object
42 43 44 |
# File 'lib/imap/backup/serializer/message.rb', line 42 def imap_body @imap_body ||= .imap_body end |
#message ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/imap/backup/serializer/message.rb', line 30 def @message = begin raw = mbox.read(offset, length) Email::Mboxrd::Message.from_serialized(raw) end end |
#subject ⇒ Object
50 51 52 |
# File 'lib/imap/backup/serializer/message.rb', line 50 def subject @subject ||= .subject end |
#to_h ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/imap/backup/serializer/message.rb', line 21 def to_h { uid: uid, offset: offset, length: length, flags: flags.map(&:to_s) } end |