forked from tobi/delayed_job
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix hooks on PerformableMethod and PerformableMailer [Closes #113]
- Loading branch information
Showing
7 changed files
with
54 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ def name | |
end | ||
|
||
def payload_object=(object) | ||
@payload_object = object | ||
self.handler = object.to_yaml | ||
end | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
module Delayed | ||
class PerformableMethod < Struct.new(:object, :method, :args) | ||
def initialize(object, method, args) | ||
raise NoMethodError, "undefined method `#{method}' for #{object.inspect}" unless object.respond_to?(method, true) | ||
class PerformableMethod < Struct.new(:object, :method_name, :args) | ||
delegate :method, :to => :object | ||
|
||
self.object = object | ||
self.args = args | ||
self.method = method.to_sym | ||
def initialize(object, method_name, args) | ||
raise NoMethodError, "undefined method `#{method_name}' for #{object.inspect}" unless object.respond_to?(method_name, true) | ||
|
||
self.object = object | ||
self.args = args | ||
self.method_name = method_name.to_sym | ||
end | ||
|
||
def display_name | ||
"#{object.class}##{method}" | ||
"#{object.class}##{method_name}" | ||
end | ||
|
||
def perform | ||
object.send(method, *args) if object | ||
object.send(method_name, *args) if object | ||
end | ||
|
||
def method_missing(symbol, *args) | ||
object.respond_to?(symbol) ? object.send(symbol, *args) : super | ||
object.send(symbol, *args) | ||
end | ||
|
||
def respond_to?(symbol, include_private=false) | ||
object.respond_to?(symbol, include_private) || super | ||
end | ||
super || object.respond_to?(symbol, include_private) | ||
end | ||
end | ||
end |
This file contains 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
This file contains 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
This file contains 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