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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: be4184ec9ebee57b30eecf66d7336883a1a3ef26
4
- data.tar.gz: 1f1ad7577366a2650a77d780f41e0ba85685a89b
2
+ SHA256:
3
+ metadata.gz: 1fd652ffb16ec0bcfaf2a3afef7da617184d1c1342783a7e91ba44bd513dcead
4
+ data.tar.gz: 2ba2915b2033ec83dab017811fd0d9beba622be4b91059950c4cb437bb1fb02b
5
5
  SHA512:
6
- metadata.gz: 1092d7f841ab7175badf44fa50b4f16f7dda6fa49627437cbe32bd54acb9c408f1917fa70e58dd1fac9422782098c467d35af29287d4ce04183a79b60601cd37
7
- data.tar.gz: a98f236ccc41d7de0c60e3f2c61e9a55b71996c7bbe1613d309e0a1bfef05ef01c10e147fa76151b5325d183e57042451f68621cf43f3e7edeabf155a086b42a
6
+ metadata.gz: 2cf672c4097d5fe242f088064d6d74554f1528dada888f8252ef885b9894cba123f82c6fa7fb234e302542a3edf1caed6e48c5bdee5f86a9b6722f3714764138
7
+ data.tar.gz: f8456636c1a3d29ed7daee13ff0b1f2a22f52b2da923c68811badc5e96563567445ae84d7db20257d502a8db4c4858e0886bc298a45ae0a30cbcd0415902d96a
data/Gemfile CHANGED
@@ -3,5 +3,3 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  gem 'rails', '>= 4.2.0'
6
- gem 'resque-status', '>= 0.5.0'
7
- gem 'resque', '1.25.0'
@@ -2,8 +2,6 @@ require 'rails'
2
2
  require 'active_job'
3
3
  require 'active_support/dependencies'
4
4
  require 'forwardable'
5
- require 'resque'
6
- require 'resque-status'
7
5
 
8
6
  require "operationable/version"
9
7
  require 'operationable/builder'
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
  module Operationable
3
3
  class Callback
4
- attr_reader :props
4
+ attr_reader :props, :q_options
5
5
 
6
- def initialize(props)
6
+ def initialize(props, q_options)
7
7
  @props = props
8
+ @q_options = q_options
8
9
  end
9
10
 
10
11
  def record
@@ -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
- (queue.blank? ? self.class : job_class_name.constantize.method(perform_method)).call(
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 : job_class.to_s.constantize.method(perform_method)).call(
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
 
@@ -1,3 +1,3 @@
1
1
  module Operationable
2
- VERSION = "0.4.7"
2
+ VERSION = "0.5.2"
3
3
  end
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.7
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: 2019-05-19 00:00:00.000000000 Z
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
- rubyforge_project:
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