resque_extensions 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,10 +10,7 @@ module ResqueExtensions
10
10
  attr_reader :args
11
11
 
12
12
  def self.perform(*args)
13
- data = self.reify_data(args)
14
- caller = data.shift
15
- # call the method with all the args
16
- caller.send(*data)
13
+ self.new(*self.reify_data(args)).perform
17
14
  end
18
15
 
19
16
  # Constructor
@@ -48,6 +45,11 @@ module ResqueExtensions
48
45
  !self.class_method?
49
46
  end
50
47
 
48
+ # Run our method
49
+ def perform
50
+ @caller.send(@method, *@args)
51
+ end
52
+
51
53
  # the queue for this job
52
54
  def queue
53
55
  @queue ||= "default"
@@ -1,3 +1,3 @@
1
1
  module ResqueExtensions
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -34,11 +34,14 @@ module ResqueExtensions
34
34
  module ObjectMethods
35
35
  # call this method asynchronously
36
36
  def async(*args)
37
+
38
+ async_method = ResqueExtensions::AsyncMethod.new(self, *args)
39
+
37
40
  if ResqueExtensions.async == true
38
- ResqueExtensions::AsyncMethod.new(self, *args).enqueue!
41
+ async_method.enqueue!
39
42
  # just call inline
40
43
  else
41
- self.send(*args)
44
+ async_method.perform
42
45
  end
43
46
  end
44
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque_extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-05 00:00:00.000000000 Z
12
+ date: 2013-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: resque