inst-jobs 0.11.7 → 0.11.8

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: a2170987cb69f7ade5944dea6c79874867c04999
4
- data.tar.gz: 274b57c924601a2a0e0196c9f72db968e22dc8d2
3
+ metadata.gz: f024416c8aac90611b46a38491ebc35373bc2136
4
+ data.tar.gz: f729a0faea215acb32cc8e9d7fbd07b05f96ba9d
5
5
  SHA512:
6
- metadata.gz: cf26bfccaa2b532ff7ae14a964d1c7c60ab88a7f30168bc2c503d723cc3bf758610965abc68cc5ae5b915c2c8b519f7794f3bfa0511c08b6d0afdf839de63671
7
- data.tar.gz: 9ddc6fa740978e8cb4c323dde2832b957b30a361618776dc2fdb56f696966e31bfe715f64ba51eee065b2952a184c4cabbaf3e967f973119bb789b11f3f2c47b
6
+ metadata.gz: 00e97f21ed4245ee6452ce553b82e8c50e62d92e70a47515d5dfed0c2d7ec4d0a76a910b8c757eaa62d00e5cd6d79e55dfa570b748156ba9fdb50e5428055847
7
+ data.tar.gz: c09a528aeb3c0a055e0e54b6692e76e418636b170af3484467f5d451d84fcd8fa867c7a1da187b9dcab9b662984fe656444fb28d8a4ec21b3a329d75fadb927e
@@ -109,21 +109,21 @@ module Delayed
109
109
  visibility = :protected
110
110
  end
111
111
 
112
- generated_delayed_methods.class_eval(<<-EOF, __FILE__, __LINE__ + 1)
113
- def #{without_method}(*args)
114
- send(:#{method}, *args, synchronous: true)
112
+ generated_delayed_methods.class_eval do
113
+ define_method without_method do |*args|
114
+ send(method, *args, synchronous: true)
115
115
  end
116
- #{visibility} :#{without_method}
116
+ send(visibility, without_method)
117
117
 
118
- def #{method}(*args, synchronous: #{!default_async})
118
+ define_method(method, -> (*args, synchronous: !default_async) do
119
119
  if synchronous
120
120
  super(*args)
121
121
  else
122
- send_later_enqueue_args(:#{method}, #{enqueue_args.inspect}, *args, synchronous: true)
122
+ send_later_enqueue_args(method, enqueue_args, *args, synchronous: true)
123
123
  end
124
- end
125
- #{visibility} :#{method}
126
- EOF
124
+ end)
125
+ send(visibility, method)
126
+ end
127
127
  end
128
128
 
129
129
  def handle_asynchronously(method, enqueue_args={})
@@ -1,3 +1,3 @@
1
1
  module Delayed
2
- VERSION = "0.11.7"
2
+ VERSION = "0.11.8"
3
3
  end
@@ -45,6 +45,17 @@ shared_examples_for 'random ruby objects' do
45
45
  obj.ran.should be true
46
46
  end
47
47
 
48
+ it 'must work with enqueue args that are lambdas' do
49
+ klass = Class.new do
50
+ attr_reader :ran
51
+ def test_method; @ran = true; end
52
+ add_send_later_methods :test_method, {singleton: -> (obj) { "foobar:#{obj.object_id}" }}, true
53
+ end
54
+
55
+ obj = klass.new
56
+ lambda { obj.test_method }.should change { Delayed::Job.jobs_count(:current) }.by(1)
57
+ end
58
+
48
59
  it "should work without default_async" do
49
60
  klass = Class.new do
50
61
  attr_accessor :ran
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inst-jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.7
4
+ version: 0.11.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-01-18 00:00:00.000000000 Z
12
+ date: 2017-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: after_transaction_commit