perform-later 1.0.0.alpha.5 → 1.0.0.alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7da3d0e8eda78f92e2f4a34a83f5c097f65388a
4
- data.tar.gz: 3feafe990731366a50be268915fba122c7ff0594
3
+ metadata.gz: 01650959394c9104dcf5177ba9d445408731a78c
4
+ data.tar.gz: cfcbfbe3e8870d8e4df0c874abd3305952fb3c6e
5
5
  SHA512:
6
- metadata.gz: dfa912a8135239477e4071bd4bf8a31b4d4866beeecf353638cbe9290b5c63d0a3e9fa8a8618b012272a7091c2a6665613df76e5d5b27d2bb3e5dc7e0b8ba235
7
- data.tar.gz: cbb1d4a69ea704f0abe9e76c97e38ada5e056999da9d1189cd23a32254874c9762868a4147b7e0ccbe29f663428b6242d3689f313a2c162a8fee97c7b48275de
6
+ metadata.gz: b54ecd5be7f6b9431b53c00cfe4f200bc54d50e513655a978b00dfe8f092aa1451b7e8152ea75475290eee334aa1d40e0e75ada1d9c8282b198da2129e970a0a
7
+ data.tar.gz: f6f729837467501ab300e18aeabb5c0d7c43974abc119f013ffcdce224e05bc0a7e0993b3b8c6dab0042dd5fd08a093a1f779e76cbf9f1d73556eb75440ab57e
@@ -37,13 +37,19 @@ module PerformLater
37
37
  # end
38
38
  # end
39
39
  def perform_later(method, opts={})
40
- self.perform_later_configs[method.to_s] = opts
40
+ config = opts.clone
41
+ aliases = Array(config.delete(:as){ ["#{method}_later", "#{method}_async"] })
42
+ self.perform_later_configs[method.to_s] = config
41
43
 
42
- define_singleton_method "#{method}_later", ->(*args) do
43
- args = call_before_serialize(opts[:before_serialize], args)
44
+ entry_point = aliases.delete_at(0)
45
+ define_singleton_method entry_point, ->(*args) do
46
+ args = call_before_serialize(config[:before_serialize], args)
44
47
  perform_async(method, *args)
45
48
  end
46
- singleton_class.send(:alias_method, "#{method}_async", "#{method}_later")
49
+
50
+ aliases.each do | entry_point_alias |
51
+ singleton_class.send(:alias_method, entry_point_alias, entry_point)
52
+ end
47
53
  end
48
54
 
49
55
  private
@@ -1,6 +1,8 @@
1
1
  module PerformLater
2
2
  module Delegation
3
-
3
+ # receive the call from the asyncronous client
4
+ # with the method we have setup to call
5
+ # and the args to be passed to the deserialization hook
4
6
  def perform(method, *args)
5
7
  config = perform_later_configs[method] || {}
6
8
  call_after_deserialize(config[:after_deserialize], *args)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perform-later
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha.5
4
+ version: 1.0.0.alpha.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Prothro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-18 00:00:00.000000000 Z
11
+ date: 2016-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq