Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@oelmekki
Created March 24, 2012 11:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oelmekki/2181381 to your computer and use it in GitHub Desktop.
Save oelmekki/2181381 to your computer and use it in GitHub Desktop.
require 'yaml'
module Delayed
module Backend
module Base
def payload_object
YAML::ENGINE.yamler = 'psych'
@payload_object ||= YAML.load(self.handler)
rescue TypeError, LoadError, NameError, ArgumentError => e
raise DeserializationError,
"Job failed to load: #{e.message}. Handler: #{handler.inspect}"
end
end
end
class PerformableMailer
def perform
double = object.is_a?( String ) ? object.constantize : object
double.send(method_name, *args).deliver
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment