delayed_after_commit 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 505deeff3ceb5cbe3e84a6ce674673877cfcc3d7
4
- data.tar.gz: 9fc961563f97c2192353fa2e6f7dcbb3cb34076d
3
+ metadata.gz: 687299ca082fb4e9f214519ae1220db104880877
4
+ data.tar.gz: e1b04ed34dcc255948620b00b646385ae1bf2de2
5
5
  SHA512:
6
- metadata.gz: 149a3108f3434350a7ca566385be95788c2e4d4eb62454770efadef9e3f13349ff904042fe3a5ed60b9025f62673a084158e2b5a448309f44dac49016c28edd2
7
- data.tar.gz: b95789a1e63856354cd6673508685653c8178f60afe202e69499e35fd29da29c29d7d760f6c21e310d5f1b98a06d94d3479d0e854165067dfe4240e7a071e01a
6
+ metadata.gz: 4796260a88f2bfee9a0a6814f8cb82ecc42bd36aaee0df1b5de1bbe1e26fa02fadf2a11d08cfe661c933d405329ce19df66913f8e767cd2229651526e24a1587
7
+ data.tar.gz: c48126fdfd2615356965c8dbb03ebe296f022bb437400e1949e48956a4a40773bf0f314e7e46b3fa9cebf744d0be6a7e2ebbd4155fc4d5003ac7962e898182a4
@@ -1,3 +1,3 @@
1
1
  module DelayedAfterCommit
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -11,23 +11,27 @@ module DelayedAfterCommit
11
11
  obj.send(method)
12
12
  end
13
13
 
14
- def delayed_after_create(method, &block)
15
- delayed_after_commit(method, on: :create, &block)
14
+ def delayed_after_create(*args, &block)
15
+ args << {on: :create}
16
+ delayed_after_commit(*args, &block)
16
17
  end
17
18
 
18
- def delayed_after_update(method, &block)
19
- delayed_after_commit(method, on: :update, &block)
19
+ def delayed_after_update(*args, &block)
20
+ args << {on: :update}
21
+ delayed_after_commit(*args, &block)
20
22
  end
21
23
 
22
24
  protected
23
- def delayed_after_commit(method, on:, &block)
25
+ def delayed_after_commit(*args, &block)
24
26
  # this creates a method that runs `enqueue_delayed_method`
25
27
  # it then adds that method to the after_commit callback
26
- delayed_method_name = "delayed_after_#{on}_#{method}"
28
+ opts = args.extract_options!
29
+ method = args.first
30
+ delayed_method_name = "delayed_after_#{opts[:on]}_#{method}"
27
31
  define_method(delayed_method_name) do |m = method|
28
32
  self.class.delay.enqueue_delayed_method(m, self.id)
29
33
  end
30
- self.after_commit(delayed_method_name.to_sym, on: on, &block)
34
+ self.after_commit(delayed_method_name.to_sym, opts, &block)
31
35
  end
32
36
  end
33
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed_after_commit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Rentzke