class Spree::SendWithUsMailer::Base

Attributes

action[R]
message[R]

Public Class Methods

default(value = nil) click to toggle source
# File lib/spree_sendwithus/mailer.rb, line 9
def default(value = nil)
  self.defaults = defaults.merge(value).freeze if value
  defaults
end
mailer_methods() click to toggle source
# File lib/spree_sendwithus/mailer.rb, line 14
def mailer_methods
  methods = public_instance_methods - superclass.public_instance_methods

  # Reject route helper methods.
  methods.reject{ |m| m.to_s.end_with?("_url", "_path") }
end
method_missing(method_name, *args) click to toggle source
Calls superclass method
# File lib/spree_sendwithus/mailer.rb, line 21
def method_missing(method_name, *args)
  if mailer_methods.include?(method_name.to_sym)
    new(method_name, *args).message
  else
    super(method_name, *args)
  end
end
new(method_name, *args) click to toggle source
# File lib/spree_sendwithus/mailer.rb, line 37
def initialize(method_name, *args)
  @message = Spree::SendWithUs::Message.new
  @action = method_name
  self.send(method_name, *args)
end
respond_to?(symbol, include_private = false) click to toggle source
Calls superclass method
# File lib/spree_sendwithus/mailer.rb, line 29
def respond_to?(symbol, include_private = false)
  super || mailer_methods.include?(symbol)
end

Public Instance Methods

assign(key, value) click to toggle source
# File lib/spree_sendwithus/mailer.rb, line 47
def assign(key, value)
  @message.assign(key, value)
end
mail(params = {}) click to toggle source
# File lib/spree_sendwithus/mailer.rb, line 43
def mail(params = {})
  @message.merge!(self.class.defaults.merge(params))
end