rydux 0.9.0 → 0.9.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
  SHA1:
3
- metadata.gz: b1682b8b97e65ab5d08e3f7bbc73706a5d7df4fa
4
- data.tar.gz: 5f64415c5777c41a64c203e098b50950c3d5472a
3
+ metadata.gz: 227768589d0be878a92145d23af95c075d3cf198
4
+ data.tar.gz: 37220686166c5b47e4787751dc712ff19e96eae3
5
5
  SHA512:
6
- metadata.gz: bd41f637c2eef4fcf69db37f912ebb5f5a74cd3e49f40fcfe031ceab26556a306711f64fefcae4a8cc916f470d62a9faad75848fb12c49dffb09e3b72ea38547
7
- data.tar.gz: ae1ade43dbed82007243cb369d9a1cff75d4588ab1ab37a4b150d0a7cd1cd8d6e68b0e76b0b8953a9fc833ce18dd75b3570f90810f0256d10dcc7ffc6700367d
6
+ metadata.gz: 9bbd10687936395ac6da6b8948a7bf7d08fb3651eafc2692a21a708ca3a2a10b33aa7a8bcc12374ce4a05673dbc54f294decfaca9156be423e1670514771e50f
7
+ data.tar.gz: ee787426f33df12e0a1f6fc352b8c7323f3f73fab99303c7395b17796449bd27e214e215544bb9e17b4c6d72687fa8db4c2484eb27b3618f996d66a050a1832a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rydux (0.9.0)
4
+ rydux (0.9.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/rydux.svg)](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.public_send(:state_changed, state)
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
@@ -1,3 +1,3 @@
1
1
  module Rydux
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
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.0
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-27 00:00:00.000000000 Z
11
+ date: 2018-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler