rails_async_methods 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: 70a7606803b98d462e11d6de8ee772cf66fd9aa7fe2355a4fc4a315a3b9f6372
4
- data.tar.gz: 0ef6b6034c8096c385aac47a0f1cfe7d65e30480d55dbb22f9035de0ddf6091c
3
+ metadata.gz: bc5c3f909c325ba16b8fe08b6a49cc02a92d2ba47ae8bff9641ed9be90a21721
4
+ data.tar.gz: 07c6c15681d352409635553dac5bfb8778cc509eac5977659ae0f067deafc31d
5
5
  SHA512:
6
- metadata.gz: d6f9cd94c505732b33480f69ebac5d8700a87227b3dd3f803cf39699f41f98d4397e6229286a6e3da4b08d04636eba028d91c0da31303bfcfe3aa559a642dd90
7
- data.tar.gz: be4580294350b8bc8d2b67f7946a71f7e4f0b16fd5e08ebc472e5f34e4202a0ada9b3133b886a59752fda6075e85953e7e9bc64a44d5df8c68cc55cc10d9b98b
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 < Application Controller
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.from_now.to_f if opts[:wait]
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
@@ -1,3 +1,3 @@
1
1
  module RailsAsyncMethods
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  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.0
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: 2022-05-15 00:00:00.000000000 Z
11
+ date: 2023-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 7.0.2.4
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: 7.0.2.4
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: activesupport
28
+ name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
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: '0'
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.3.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