operationable 0.4.7 → 0.5.2
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 +5 -5
- data/Gemfile +0 -2
- data/lib/operationable.rb +0 -2
- data/lib/operationable/callback.rb +3 -2
- data/lib/operationable/runners/base.rb +4 -0
- data/lib/operationable/runners/separate.rb +5 -3
- data/lib/operationable/runners/serial.rb +3 -2
- data/lib/operationable/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1fd652ffb16ec0bcfaf2a3afef7da617184d1c1342783a7e91ba44bd513dcead
|
4
|
+
data.tar.gz: 2ba2915b2033ec83dab017811fd0d9beba622be4b91059950c4cb437bb1fb02b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cf672c4097d5fe242f088064d6d74554f1528dada888f8252ef885b9894cba123f82c6fa7fb234e302542a3edf1caed6e48c5bdee5f86a9b6722f3714764138
|
7
|
+
data.tar.gz: f8456636c1a3d29ed7daee13ff0b1f2a22f52b2da923c68811badc5e96563567445ae84d7db20257d502a8db4c4858e0886bc298a45ae0a30cbcd0415902d96a
|
data/Gemfile
CHANGED
data/lib/operationable.rb
CHANGED
@@ -116,6 +116,10 @@ module Operationable
|
|
116
116
|
sync? ? job_sync_execute_method : job_async_execute_method
|
117
117
|
end
|
118
118
|
|
119
|
+
def perform(job_class_name, args)
|
120
|
+
job_class_name.to_s.constantize.method(perform_method).call(args)
|
121
|
+
end
|
122
|
+
|
119
123
|
def sync?
|
120
124
|
%w(test development).include? Rails.env
|
121
125
|
end
|
@@ -10,10 +10,12 @@ module Operationable
|
|
10
10
|
# callback can be class
|
11
11
|
# callback_class = callback_method_name.to_s.safe_constantize
|
12
12
|
|
13
|
-
|
13
|
+
args = {
|
14
14
|
q_options: q_options(callback_method_name, queue),
|
15
15
|
props: props.merge(params)
|
16
|
-
|
16
|
+
}
|
17
|
+
|
18
|
+
queue.blank? ? self.class.call(args) : perform(job_class_name, args)
|
17
19
|
end
|
18
20
|
|
19
21
|
def q_options(callback_method_name, queue)
|
@@ -24,7 +26,7 @@ module Operationable
|
|
24
26
|
end
|
25
27
|
|
26
28
|
def self.call(q_options:, props:)
|
27
|
-
q_options[:callback_class_name].constantize.new(props).method(q_options[:callback_method_name]).call
|
29
|
+
q_options[:callback_class_name].constantize.new(props, q_options).method(q_options[:callback_method_name]).call
|
28
30
|
end
|
29
31
|
end
|
30
32
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
# TODO: never used, may be remove
|
2
3
|
module Operationable
|
3
4
|
module Runners
|
4
5
|
class Serial < ::Operationable::Runners::Base
|
@@ -7,14 +8,14 @@ module Operationable
|
|
7
8
|
end
|
8
9
|
|
9
10
|
def process
|
10
|
-
(queue.blank? ? self.class :
|
11
|
+
(queue.blank? ? self.class : perform(job_class_name)).call(
|
11
12
|
q_options: q_options,
|
12
13
|
props: props
|
13
14
|
)
|
14
15
|
end
|
15
16
|
|
16
17
|
def self.call(q_options:, props:)
|
17
|
-
instance = q_options[:callback_class_name].constantize.new(props)
|
18
|
+
instance = q_options[:callback_class_name].constantize.new(props, q_options)
|
18
19
|
q_options[:callback_names].each { |method_name| instance.method(method_name).call }
|
19
20
|
end
|
20
21
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: operationable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Suhodolov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-12-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activejob
|
@@ -121,8 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
|
-
|
125
|
-
rubygems_version: 2.6.10
|
124
|
+
rubygems_version: 3.1.4
|
126
125
|
signing_key:
|
127
126
|
specification_version: 4
|
128
127
|
summary: Implementation of command pattern to avoid ActiveRecord callbacks and get
|