rails_async_methods 0.2.0 → 0.2.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 +4 -4
- data/README.md +11 -3
- data/lib/rails_async_methods/active_job_options_parser.rb +1 -1
- data/lib/rails_async_methods/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc5c3f909c325ba16b8fe08b6a49cc02a92d2ba47ae8bff9641ed9be90a21721
|
4
|
+
data.tar.gz: 07c6c15681d352409635553dac5bfb8778cc509eac5977659ae0f067deafc31d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 592c26c40c0d23e4d6a52676bb7323e271e66e54940031ea242cffe029e300473dfd0ce44b7260c3d81de4c1ef34a99becbb48584c65e87979898bcaed271839
|
7
|
+
data.tar.gz: 705aff342859b61a299f378e6d2ae9f62950a35c13735f280505bdba28255f2f6534950bf1878c51b22ba4b68ad50728bb3699ce483c926a4965d1511b6313bb
|
data/README.md
CHANGED
@@ -9,6 +9,12 @@ class User
|
|
9
9
|
# logic...
|
10
10
|
end
|
11
11
|
async :example_method
|
12
|
+
|
13
|
+
# or...
|
14
|
+
|
15
|
+
async def example_method2
|
16
|
+
# logic...
|
17
|
+
end
|
12
18
|
end
|
13
19
|
```
|
14
20
|
This will give you access to ```user_instance.async_example_method```, which when called will use ActiveJob's API to create an ActiveJob with your backend of choice and call the example_method when the job is ran.
|
@@ -23,9 +29,9 @@ async :example_method_with_args
|
|
23
29
|
the ```async_example_method_with_args``` method will have a signature that matches the original method. This makes testing and debugging during development faster, as both sync and async method calls will fail when called with improper arguments instead of silently failing as an active job.
|
24
30
|
|
25
31
|
### Object Wrapper
|
26
|
-
Alternatively, if you don't to declare methods as async in your model, you can utilize the async object wrapper made available globally to all objects.
|
32
|
+
Alternatively, if you don't want to declare methods as async in your model, you can utilize the async object wrapper made available globally to all objects.
|
27
33
|
```ruby
|
28
|
-
class ResourceController <
|
34
|
+
class ResourceController < ApplicationController
|
29
35
|
def create
|
30
36
|
async(@resource).any_method_available_to_resource
|
31
37
|
end
|
@@ -58,7 +64,9 @@ user_instance.asynchronous_example_method
|
|
58
64
|
- job: use a custom job other than the generated ```RailsAsyncMethods::AbstractJob``` - see section on Custom Jobs below i.e.
|
59
65
|
```ruby
|
60
66
|
async :example_method, job: CustomExampleMethodJob # defined in model
|
61
|
-
async(@resource, job: CustomExampleMethodJob).example_method #callable anywhere
|
67
|
+
async(@resource, job: CustomExampleMethodJob).example_method # callable anywhere
|
68
|
+
@resource.to_active_job(job: CustomExampleMethodJob).example_method
|
69
|
+
|
62
70
|
```
|
63
71
|
|
64
72
|
- ActiveJob configurations
|
@@ -9,7 +9,7 @@ module RailsAsyncMethods
|
|
9
9
|
@prefix = method_prefix(opts[:prefix])
|
10
10
|
@queue = opts[:queue]
|
11
11
|
@wait_until = opts[:wait_until].to_f if opts[:wait_until]
|
12
|
-
@wait = opts[:wait].seconds.
|
12
|
+
@wait = opts[:wait].seconds.to_f if opts[:wait]
|
13
13
|
@priority = opts[:priority].to_i if opts[:priority]
|
14
14
|
@job = get_job_obj(opts[:job])
|
15
15
|
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_async_methods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- benngarcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 7.0.2.4
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 7.0.2.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
|
-
rubygems_version: 3.
|
138
|
+
rubygems_version: 3.1.6
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Quickly, create async callers and receivers for your rails methods, because
|