rydux 0.9.0 → 0.9.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/Gemfile.lock +1 -1
- data/README.md +4 -2
- data/lib/rydux/store.rb +7 -5
- data/lib/rydux/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 227768589d0be878a92145d23af95c075d3cf198
|
4
|
+
data.tar.gz: 37220686166c5b47e4787751dc712ff19e96eae3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bbd10687936395ac6da6b8948a7bf7d08fb3651eafc2692a21a708ca3a2a10b33aa7a8bcc12374ce4a05673dbc54f294decfaca9156be423e1670514771e50f
|
7
|
+
data.tar.gz: ee787426f33df12e0a1f6fc352b8c7323f3f73fab99303c7395b17796449bd27e214e215544bb9e17b4c6d72687fa8db4c2484eb27b3618f996d66a050a1832a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[](https://badge.fury.io/rb/rydux)
|
2
|
+
|
1
3
|
# Rydux
|
2
4
|
|
3
5
|
A ruby gem that brings the functionality of Redux to your backend.
|
@@ -63,7 +65,7 @@ Or install it yourself as:
|
|
63
65
|
# Every instance that subscribes to the store will
|
64
66
|
# get this state_changed method called whenever the state
|
65
67
|
# in the store changes. Do whatever you want with your state here.
|
66
|
-
def state_changed(state)
|
68
|
+
def state_changed(state, last_dispatch_type)
|
67
69
|
# ...
|
68
70
|
end
|
69
71
|
end
|
@@ -100,7 +102,7 @@ class Friend
|
|
100
102
|
@users_name = Store.state.user.name
|
101
103
|
end
|
102
104
|
|
103
|
-
def state_changed(state)
|
105
|
+
def state_changed(state, last_dispatch_type)
|
104
106
|
@users_name = state.user.name
|
105
107
|
end
|
106
108
|
|
data/lib/rydux/store.rb
CHANGED
@@ -32,7 +32,7 @@ module Rydux
|
|
32
32
|
@reducers.each do |k, reducer|
|
33
33
|
new_state = {}
|
34
34
|
new_state[k] = reducer.map_state(action, state[k])
|
35
|
-
set_state(new_state)
|
35
|
+
set_state(new_state, action[:type])
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -42,7 +42,7 @@ module Rydux
|
|
42
42
|
|
43
43
|
private
|
44
44
|
|
45
|
-
def set_state(new_state)
|
45
|
+
def set_state(new_state, last_dispatch = nil)
|
46
46
|
new_state.each do |k, v|
|
47
47
|
@state[k] = v
|
48
48
|
|
@@ -52,13 +52,15 @@ module Rydux
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
notify_listeners
|
55
|
+
notify_listeners(last_dispatch)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
def notify_listeners
|
59
|
+
def notify_listeners(last_dispatch)
|
60
60
|
@listeners.each do |listener|
|
61
|
-
listener.
|
61
|
+
if listener.respond_to? :state_changed
|
62
|
+
listener.public_send(:state_changed, state, last_dispatch)
|
63
|
+
end
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
data/lib/rydux/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rydux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Dovzhanyn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|