rdux 0.11.0 → 0.12.0
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/lib/rdux/version.rb +1 -1
- data/lib/rdux.rb +10 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb992b109d0983534ec092280239b9eb1f689f9e92f5f011047660215ab6a39a
|
4
|
+
data.tar.gz: 22abeef261cd3d464361ed7b910ce8d033c611e5681f9228e631c99d88758f87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4aa7c1246cdfd68af71e4171f1e20bab160c52a1e9d891519209a3dd2308307e87ead38b3e66ffce317136de745bfedf88a10544d970bf13e89d58528ab570cf
|
7
|
+
data.tar.gz: 21b865e2527a7df5d2ab952d44fd607e3fafb8f91f116839d60de3b51f2a5ebec4660e1691e667ad70717fcc6f88fe8e233ff9473f02280fb21e9c294a29c73c
|
data/lib/rdux/version.rb
CHANGED
data/lib/rdux.rb
CHANGED
@@ -8,14 +8,11 @@ require 'active_support/concern'
|
|
8
8
|
module Rdux
|
9
9
|
class << self
|
10
10
|
def dispatch(action_name, payload, opts = {}, meta: nil)
|
11
|
-
|
12
|
-
action = Action.new(name: action_name, up_payload: payload, meta:)
|
13
|
-
sanitize(action)
|
14
|
-
action.save!
|
11
|
+
action = create_action(action_name, payload, opts, meta)
|
15
12
|
res = call_call_or_up_on_action(action, opts)
|
16
13
|
res.up_result ||= opts[:up_result]
|
17
14
|
assign_and_persist(res, action)
|
18
|
-
res.after_save
|
15
|
+
res.after_save.call(res.action) if res.after_save && res.action
|
19
16
|
res
|
20
17
|
end
|
21
18
|
|
@@ -23,6 +20,14 @@ module Rdux
|
|
23
20
|
|
24
21
|
private
|
25
22
|
|
23
|
+
def create_action(action_name, payload, opts, meta)
|
24
|
+
(opts[:ars] || {}).each { |k, v| payload["#{k}_id"] = v.id }
|
25
|
+
action = Action.new(name: action_name, up_payload: payload, meta:)
|
26
|
+
sanitize(action)
|
27
|
+
action.save!
|
28
|
+
action
|
29
|
+
end
|
30
|
+
|
26
31
|
def call_call_or_up_on_action(action, opts)
|
27
32
|
res = action.call(opts)
|
28
33
|
if res
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zbigniew Humeniuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 1.5.
|
39
|
+
version: 1.5.9
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 1.5.
|
46
|
+
version: 1.5.9
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rubocop
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|