Created
May 24, 2012 14:36
-
-
Save jmcnevin/2781931 to your computer and use it in GitHub Desktop.
Worker class that will mark all methods as TorqueBox backgroundable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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