Class: Webspicy::Tester::Fakesmtp::Email
- Inherits:
-
Object
- Object
- Webspicy::Tester::Fakesmtp::Email
- Defined in:
- lib/webspicy/tester/fakesmtp/email.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #from ⇒ Object
-
#initialize(data) ⇒ Email
constructor
A new instance of Email.
- #reply_to ⇒ Object
- #subject ⇒ Object
- #to ⇒ Object
Constructor Details
#initialize(data) ⇒ Email
Returns a new instance of Email.
6 7 8 |
# File 'lib/webspicy/tester/fakesmtp/email.rb', line 6 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/webspicy/tester/fakesmtp/email.rb', line 9 def data @data end |
Instance Method Details
#from ⇒ Object
11 12 13 14 15 16 |
# File 'lib/webspicy/tester/fakesmtp/email.rb', line 11 def from @from ||= data["headerLines"] .select{|h| h["key"] == "from" } .map{|h| h["line"][/From:\s*(.*)$/, 1] } .first end |
#reply_to ⇒ Object
24 25 26 27 28 |
# File 'lib/webspicy/tester/fakesmtp/email.rb', line 24 def reply_to @reply_to ||= data["headerLines"] .select{|h| h["key"] == "reply-to" } .map{|h| h["line"][/Reply-To:\s*(.*)$/, 1] } end |
#subject ⇒ Object
30 31 32 33 34 35 |
# File 'lib/webspicy/tester/fakesmtp/email.rb', line 30 def subject @subject ||= data["headerLines"] .select{|h| h["key"] == "subject" } .map{|h| h["line"][/Subject:\s*(.*)$/, 1] } .first end |
#to ⇒ Object
18 19 20 21 22 |
# File 'lib/webspicy/tester/fakesmtp/email.rb', line 18 def to @to ||= data["headerLines"] .select{|h| h["key"] == "to" } .map{|h| h["line"][/To:\s*(.*)$/, 1] } end |