Class: Mail
- Inherits:
-
Object
- Object
- Defined in:
- lib/sinatra/extensions/mail.rb
Direct Known Subclasses
Instance Method Summary collapse
- #from ⇒ Object
-
#initialize(args) ⇒ Mail
constructor
A new instance of Mail.
- #send ⇒ Object
- #subject ⇒ Object
- #template ⇒ Object
- #to ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize(args) ⇒ Mail
Returns a new instance of Mail.
4 5 6 7 |
# File 'lib/sinatra/extensions/mail.rb', line 4 def initialize(args) @receivers = args[:to] @sender = args[:from] end |
Instance Method Details
#from ⇒ Object
27 28 29 |
# File 'lib/sinatra/extensions/mail.rb', line 27 def from @sender ||= "[email protected]" end |
#send ⇒ Object
31 32 33 |
# File 'lib/sinatra/extensions/mail.rb', line 31 def send MailSender.perform_async(self) end |
#subject ⇒ Object
13 14 15 |
# File 'lib/sinatra/extensions/mail.rb', line 13 def subject raise Exception, "You have to override 'subject' method in #{self.class}" end |
#template ⇒ Object
9 10 11 |
# File 'lib/sinatra/extensions/mail.rb', line 9 def template raise Exception, "You have to override 'template' method in #{self.class}" end |
#to ⇒ Object
21 22 23 24 25 |
# File 'lib/sinatra/extensions/mail.rb', line 21 def to _receivers = {} @receivers.each { |user| _receivers[user.full_name] = "Persons" } _receivers end |
#values ⇒ Object
17 18 19 |
# File 'lib/sinatra/extensions/mail.rb', line 17 def values raise Exception, "You have to override 'values' method in #{self.class}" end |