Module: Mailthis::Mailer::InstanceMethods
- Defined in:
- lib/mailthis/mailer.rb
Instance Method Summary collapse
- #deliver(message = nil, &block) ⇒ Object
- #initialize(values = nil, &block) ⇒ Object
- #validate! ⇒ Object
Instance Method Details
#deliver(message = nil, &block) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/mailthis/mailer.rb', line 51 def deliver( = nil, &block) ( || ::Mailthis::Message.new).tap do |msg| msg.instance_eval(&block) if block OutgoingEmail.new(self, msg).deliver end end |
#initialize(values = nil, &block) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/mailthis/mailer.rb', line 38 def initialize(values = nil, &block) # this is defaulted here because we want to use the Configuration instance # `smtp_user`. If we define a proc above, we will be using the Configuration # class `smtp_user`, which will not update the option as expected. super((values || {}).merge(:from => proc{ self.smtp_user })) self.define(&block) end |
#validate! ⇒ Object
46 47 48 49 |
# File 'lib/mailthis/mailer.rb', line 46 def validate! raise(MailerError, "missing required settings") if !valid? self # for chaining end |