sidekiq-later 0.1.1 → 0.1.2

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: 1365cebfc34c734cbd5d7c0693a035341f7c055e
4
- data.tar.gz: 0c9b723082d7a809869c82a58573824048216ee6
3
+ metadata.gz: 8fc516fe00d0f5220046cdbe989e468031c29e48
4
+ data.tar.gz: 9fdddfc5b13ca58d99d79156ca471053ef76bc44
5
5
  SHA512:
6
- metadata.gz: 5003296534d6ba68c6e8c4960fb54b87a5934f183d93d694628889b14db9cc6b2c10392b5d477cd2a1b0ef3533ccdab7f99fad317b562e35c9e0578a52cab49c
7
- data.tar.gz: 4cc53a439e8a018867dd906e903505cf5fcf6df1285827c1d65d77021b5ee030d4c4e4a4a74ce206a51b01fbaa3ed934b07c753dbf7880ff5954c3d62e834d1f
6
+ metadata.gz: 811880dd7fe1db515eeebed132fed3d02e4b1232fae13f208d661c1e917c224a80c018a745c7ddae03e34a0aae9544036cf94c2cb95d951f6e418c4495590a76
7
+ data.tar.gz: 8d9b9f650793295233e7eeb6908c048afc3b40b3acb01282c1df1ad834d3aca49bb5f02caf5d45f7d915eca1bf64465616f80f9bd36986aa28f2ae6e5c495f6f
@@ -1,12 +1,10 @@
1
+ require 'sidekiq'
1
2
  require 'sidekiq/later/version'
2
3
  require 'sidekiq/later/method_mixin'
3
4
  require 'sidekiq/later/worker'
5
+ require 'sidekiq/later/active_record' if defined?(ActiveRecord::Base)
4
6
 
5
7
  module Sidekiq
6
8
  module Later
7
9
  end
8
10
  end
9
-
10
- if defined?(ActiveRecord::Base)
11
- ActiveRecord::Base.send :include, Sidekiq::Later::MethodMixin
12
- end
@@ -0,0 +1 @@
1
+ ActiveRecord::Base.send :include, Sidekiq::Later::MethodMixin
@@ -2,18 +2,17 @@ module Sidekiq
2
2
  module Later
3
3
  module MethodMixin
4
4
  class MethodProxy < BasicObject
5
- attr_accessor :target_class, :id, :inline
5
+ attr_accessor :target, :inline
6
6
 
7
- def initialize(klass, id, inline = false)
8
- @target_class = klass
9
- @target_id = id
7
+ def initialize(target, inline = false)
8
+ @target = target
10
9
  @inline = inline
11
10
  end
12
11
 
13
12
  def method_missing(name, *args, &block)
14
- super unless target_class.new.respond_to?(name)
13
+ super unless target.respond_to?(name)
15
14
 
16
- worker_args = [target_class.to_s, @target_id, name, *args]
15
+ worker_args = [target.class.to_s, target.id, name, *args]
17
16
 
18
17
  if inline
19
18
  Worker.new.perform *worker_args
@@ -28,7 +27,7 @@ module Sidekiq
28
27
  end
29
28
 
30
29
  def later(inline: false)
31
- MethodProxy.new(self.class, self.id, inline)
30
+ MethodProxy.new(self, inline)
32
31
  end
33
32
  end
34
33
  end
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Later
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -1,3 +1,5 @@
1
+ require 'active_support/core_ext/string/inflections'
2
+
1
3
  module Sidekiq
2
4
  module Later
3
5
  class Worker
@@ -22,7 +22,12 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
+ spec.add_dependency "sidekiq"
26
+ spec.add_dependency "activesupport"
27
+
25
28
  spec.add_development_dependency "bundler", "~> 1.16"
26
29
  spec.add_development_dependency "rake", "~> 10.0"
27
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
+ spec.add_development_dependency "rspec-sidekiq"
32
+ spec.add_development_dependency "pry"
28
33
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-later
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig McNamara
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-03 00:00:00.000000000 Z
11
+ date: 2018-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sidekiq
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: bundler
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +80,34 @@ dependencies:
52
80
  - - "~>"
53
81
  - !ruby/object:Gem::Version
54
82
  version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-sidekiq
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
55
111
  description: Like the .delay method without YAML serialization.
56
112
  email:
57
113
  - craig.mcnamara@gmail.com
@@ -71,6 +127,7 @@ files:
71
127
  - bin/setup
72
128
  - lib/sidekiq-later.rb
73
129
  - lib/sidekiq/later.rb
130
+ - lib/sidekiq/later/active_record.rb
74
131
  - lib/sidekiq/later/method_mixin.rb
75
132
  - lib/sidekiq/later/version.rb
76
133
  - lib/sidekiq/later/worker.rb