Class: OnlyofficeGmailHelper::MailMessage
- Inherits:
-
Object
- Object
- OnlyofficeGmailHelper::MailMessage
- Defined in:
- lib/onlyoffice_gmail_helper/mail_message.rb
Overview
Class for working with single message
Instance Attribute Summary collapse
-
#content ⇒ String
Mail content.
-
#date ⇒ String
Date field.
-
#reply_to ⇒ String
Reply to field.
-
#tags ⇒ String
Tags field.
-
#title ⇒ String
Mail title.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Compare message with other.
-
#initialize(title, content = nil, reply_to = nil, date = nil, tags = nil) ⇒ MailMessage
constructor
A new instance of MailMessage.
Constructor Details
#initialize(title, content = nil, reply_to = nil, date = nil, tags = nil) ⇒ MailMessage
Returns a new instance of MailMessage.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/onlyoffice_gmail_helper/mail_message.rb', line 17 def initialize(title, content = nil, reply_to = nil, date = nil, = nil) @title = title @content = content @reply_to = reply_to unless @content.nil? && !content.is_a?(Regexp) begin @content.delete!("\n") rescue StandardError Exception end begin @content.gsub!("\r\n", '') rescue StandardError Exception end begin @content.gsub!("\n\n", '') rescue StandardError Exception end begin @content.gsub!('“', '"') rescue StandardError Exception end begin @content.gsub!('”', '"') rescue StandardError Exception end begin @content.tr!("\r", ' ') rescue StandardError Exception end end @date = date @tags = end |
Instance Attribute Details
#content ⇒ String
Returns mail content.
9 10 11 |
# File 'lib/onlyoffice_gmail_helper/mail_message.rb', line 9 def content @content end |
#date ⇒ String
Returns date field.
13 14 15 |
# File 'lib/onlyoffice_gmail_helper/mail_message.rb', line 13 def date @date end |
#reply_to ⇒ String
Returns reply to field.
11 12 13 |
# File 'lib/onlyoffice_gmail_helper/mail_message.rb', line 11 def reply_to @reply_to end |
#tags ⇒ String
Returns tags field.
15 16 17 |
# File 'lib/onlyoffice_gmail_helper/mail_message.rb', line 15 def @tags end |
#title ⇒ String
Returns mail title.
7 8 9 |
# File 'lib/onlyoffice_gmail_helper/mail_message.rb', line 7 def title @title end |
Instance Method Details
#==(other) ⇒ Boolean
Compare message with other
60 61 62 63 64 65 |
# File 'lib/onlyoffice_gmail_helper/mail_message.rb', line 60 def ==(other) compare_title = (title.delete("\n") == other.title.delete("\n")) compare_body = true compare_body = false if (StaticDataTeamLab.check_email_body if defined?(StaticDataTeamLab.check_email_body)) && compare_title && (other.content =~ content).nonzero? compare_title && compare_body end |