activejob_delayed_execution 1.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5868a6ccae8f864df0f48b387b9e70026e0a217d
4
+ data.tar.gz: b96d6a2a4b9e41b749b49a03637937aa7362dee4
5
+ SHA512:
6
+ metadata.gz: e44e88404d5c00893b0690d9acec0bafa6162d04ebe5d4d0b12a20da289845c71aafa8dd35b83670c0bdba408edea99152e77bf44d04cfd25aec4957874b776d
7
+ data.tar.gz: 0ba2a680a761e7477d0a742939322fba4eb5c830c5a28cad8a3b1b740ff3816480f9b17ed596d8530762acd0847680d5f6dfae63fcb3b46db83b4248ca92df77
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --require spec_helper
3
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ before_install: gem install bundler -v 1.11.2
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 alpaca-tc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # active_job_delayed_execution
2
+
3
+ `active_job_delayed_execution` provides very simple delayed behavior for Ruby.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'activejob'
11
+ gem 'active_job_delayed_execution'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install active_job_delayed_execution
21
+
22
+ ## Usage
23
+
24
+ ```
25
+ # config/initializers/activejob_delayed_execution.rb
26
+ # Define .delayed method
27
+ ActiveRecord::Base.include(ActiveJobDelayedExecution::Delayable)
28
+ # ActiveJobDelayedExecution.parent_class_name = 'ApplicationJob'
29
+
30
+ class User < ActiveRecord::Base
31
+ def very_slow_method; end
32
+ def very_slow_method_with_arguments(a, b, c); end
33
+ end
34
+
35
+ User.first.delayed.very_slow_method #=> Enqueues delayed_job
36
+ User.first.delayed.very_slow_method_with_arguments('1', '2', '3') #=> Enqueues delayed_job
37
+ ```
38
+
39
+ ## Contributing
40
+
41
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/alpaca-tc/active_job_delayed_execution](https://github.com/alpaca-tc/active_job_delayed_execution).
42
+
43
+ ## License
44
+
45
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,23 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require 'active_job_delayed_execution/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'activejob_delayed_execution'
8
+ spec.version = ActiveJobDelayedExecution::VERSION
9
+ spec.authors = ['alpaca-tc']
10
+ spec.email = ['alpaca-tc@alpaca.tc']
11
+
12
+ spec.summary = %q{active_job_delayed_execution provides very simple delayed behavior for Ruby.}
13
+ spec.homepage = 'https://github.com/alpaca-tc/active_job_delayed_execution'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
17
+ spec.require_paths = ['lib']
18
+
19
+ spec.add_dependency 'activejob', '>= 4.2.0'
20
+ spec.add_development_dependency 'bundler', '~> 1.11'
21
+ spec.add_development_dependency 'rake', '~> 10.0'
22
+ spec.add_development_dependency 'rspec', '~> 3.0'
23
+ end
@@ -0,0 +1,7 @@
1
+ module ActiveJobDelayedExecution
2
+ module Delayable
3
+ def delayed
4
+ ActiveJobDelayedExecution::Proxy.new(self)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module ActiveJobDelayedExecution
2
+ class DelayedExecutionJob < ActiveJobDelayedExecution.parent_class
3
+ def perform(object, public_method_name, *arguments)
4
+ object.public_send(public_method_name, *arguments)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ module ActiveJobDelayedExecution
2
+ class Proxy < BasicObject
3
+ def initialize(object)
4
+ @object = object
5
+ end
6
+
7
+ def method_missing(name, *args)
8
+ DelayedExecutionJob.perform_later(@object, name.to_s, *args)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module ActiveJobDelayedExecution
2
+ VERSION = '1.0.1'
3
+ end
@@ -0,0 +1,15 @@
1
+ require 'active_job'
2
+ require 'active_job_delayed_execution/version'
3
+
4
+ module ActiveJobDelayedExecution
5
+ autoload :DelayedExecutionJob, 'active_job_delayed_execution/delayed_execution_job'
6
+ autoload :Delayable, 'active_job_delayed_execution/delayable'
7
+ autoload :Proxy, 'active_job_delayed_execution/proxy'
8
+
9
+ mattr_accessor :parent_class_name
10
+ self.parent_class_name = 'ActiveJob::Base'
11
+
12
+ def self.parent_class
13
+ parent_class_name.constantize
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activejob_delayed_execution
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - alpaca-tc
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-03-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activejob
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 4.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.11'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.11'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description:
70
+ email:
71
+ - alpaca-tc@alpaca.tc
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - activejob_delayed_execution.gemspec
84
+ - lib/active_job_delayed_execution.rb
85
+ - lib/active_job_delayed_execution/delayable.rb
86
+ - lib/active_job_delayed_execution/delayed_execution_job.rb
87
+ - lib/active_job_delayed_execution/proxy.rb
88
+ - lib/active_job_delayed_execution/version.rb
89
+ homepage: https://github.com/alpaca-tc/active_job_delayed_execution
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.6.11
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: active_job_delayed_execution provides very simple delayed behavior for Ruby.
113
+ test_files: []