Class: Message
- Inherits:
-
Object
- Object
- Message
- Defined in:
- lib/helpers/mail2wiki-helper.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#message_id ⇒ Object
readonly
Returns the value of attribute message_id.
-
#sender_email ⇒ Object
readonly
Returns the value of attribute sender_email.
-
#sender_name ⇒ Object
readonly
Returns the value of attribute sender_name.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(imap, message_id) ⇒ Message
constructor
A new instance of Message.
- #plain_text_content_from_message(id) ⇒ Object
Constructor Details
#initialize(imap, message_id) ⇒ Message
Returns a new instance of Message.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/helpers/mail2wiki-helper.rb', line 14 def initialize( imap, ) @imap, @message_id = imap, envelope = @imap.fetch( @message_id, 'ENVELOPE' ).first.attr['ENVELOPE'] @subject = envelope['subject'].gsub(/^(Fw|Re):?/i,'').strip @sender_name = envelope['from'].first['name'] @date = envelope['date'] @sender_email = envelope['from'].first['mailbox'] + ' at ' + envelope['from'].first['host'] @sender_name = @sender_email unless @sender_name && @sender_name.size > 1 @sender_name.gsub!(/@/,' at ') @text = ( ) end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
12 13 14 |
# File 'lib/helpers/mail2wiki-helper.rb', line 12 def date @date end |
#message_id ⇒ Object (readonly)
Returns the value of attribute message_id.
12 13 14 |
# File 'lib/helpers/mail2wiki-helper.rb', line 12 def @message_id end |
#sender_email ⇒ Object (readonly)
Returns the value of attribute sender_email.
12 13 14 |
# File 'lib/helpers/mail2wiki-helper.rb', line 12 def sender_email @sender_email end |
#sender_name ⇒ Object (readonly)
Returns the value of attribute sender_name.
12 13 14 |
# File 'lib/helpers/mail2wiki-helper.rb', line 12 def sender_name @sender_name end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
12 13 14 |
# File 'lib/helpers/mail2wiki-helper.rb', line 12 def subject @subject end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
12 13 14 |
# File 'lib/helpers/mail2wiki-helper.rb', line 12 def text @text end |
Instance Method Details
#plain_text_content_from_message(id) ⇒ Object
26 27 28 |
# File 'lib/helpers/mail2wiki-helper.rb', line 26 def ( id ) @imap.fetch( id, 'BODY[1]' ).first.attr['BODY[1]'].from_quoted_printable end |