Class: LeanMail::Data
- Inherits:
-
Object
- Object
- LeanMail::Data
- Defined in:
- contrib/lib/lean_mail.rb
Overview
RFC 2821 message data representation.
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(from, to, subject, message) ⇒ Data
constructor
A new instance of Data.
-
#to_s ⇒ Object
Constructor Details
#initialize(from, to, subject, message) ⇒ Data
Returns a new instance of Data.
36 37 38 39 40 41 |
# File 'contrib/lib/lean_mail.rb', line 36 def initialize(from, to, subject, ) @from = from @to = to @subject = subject @message = end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
34 35 36 |
# File 'contrib/lib/lean_mail.rb', line 34 def from @from end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
34 35 36 |
# File 'contrib/lib/lean_mail.rb', line 34 def @message end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
34 35 36 |
# File 'contrib/lib/lean_mail.rb', line 34 def subject @subject end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
34 35 36 |
# File 'contrib/lib/lean_mail.rb', line 34 def to @to end |
Instance Method Details
#to_s ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'contrib/lib/lean_mail.rb', line 43 def to_s <<~MAIL From: #{@from} To: #{to.instance_of?(Array) ? to.join(', ') : to} Subject: #{subject} Date: #{Time.new.rfc2822} Message-Id: <#{SecureRandom.uuid}@#{Socket.gethostname}> #{@message} MAIL end |