Module: Resque::Mailer::ClassMethods

Defined in:
lib/resque_mailer.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_symbol, *params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/resque_mailer.rb', line 9

def method_missing(method_symbol, *params)
      
  if ::Resque::Mailer.excluded_environments &&
    ::Resque::Mailer.excluded_environments.include?(::RAILS_ENV.to_sym)
    return super(method_symbol, *params)
  end
      
  case method_symbol.id2name
  when /^deliver_([_a-z]\w*)\!/ then super(method_symbol, *params)
  when /^deliver_([_a-z]\w*)/ then ::Resque.enqueue(self, "#{method_symbol}!", *params)
  else super(method_symbol, *params)
  end
end

Instance Method Details

#perform(cmd, *args) ⇒ Object



27
28
29
# File 'lib/resque_mailer.rb', line 27

def perform(cmd, *args)
  send(cmd, *args)
end

#queueObject



23
24
25
# File 'lib/resque_mailer.rb', line 23

def queue
  :mailer
end