Skip to content

Instantly share code, notes, and snippets.

@jmcnevin
Created May 24, 2012 14:36
Show Gist options
  • Save jmcnevin/2781931 to your computer and use it in GitHub Desktop.
Save jmcnevin/2781931 to your computer and use it in GitHub Desktop.
Worker class that will mark all methods as TorqueBox backgroundable
# In a worker class, all defined public methods will be marked to run in the
# background
class Worker
include TorqueBox::Messaging::Backgroundable
def self.method_added(method_name)
return if method_name.to_s =~ /^__a?sync/ # avoid infinite loop
return unless public_method_defined?(method_name)
always_background method_name
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment