grand_central 0.6.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 942e52cba28a0ca4673e0783c821deb3640de636ff5bb3b9a2fff17a7ef54ae9
4
- data.tar.gz: f7f7a7dff69daa25ecc781585a7707f776012c8c7ad3ff3517838505586dfdf1
3
+ metadata.gz: bdf2cddcf8d8dd60b0ed935c59465212894b34c10bba4fa411668af4a10f1413
4
+ data.tar.gz: 6e962588d51ff887e484e29a2d92b58d6c3c591d69cd5812e884e28f712b6dc0
5
5
  SHA512:
6
- metadata.gz: 6150e9351b2e8b1e03c095683799c8524c6591e8493f67e644982506176c64b3eea13e9acc2e6febdc4546f0f2148a6adbfd9de9f296d20d184cb725937462af
7
- data.tar.gz: 78ec6112b71c44b39e56ac05cb633f454faddc8800f7d25d360967b6d6f92f7145d46d55e5516e3f435e7dd43fe85388e9110b23c73958b174d58d9664cd9655
6
+ metadata.gz: fb77a7aedb047d02040c990741f70a2f7e6ca717945b6c9ae210ea119ab4af791a8cb79cf623fd12db039546a5b5be5d1a2d1b5de9039900e62f73cd65a9a18e
7
+ data.tar.gz: 12fc78c06f8131c8be47a84a9094aabc9c389969589be45fa2b177d92804930e08e06dc2344c2b56b9573f1662143ba28daec48c3ab933257e7877067d6e1e75
@@ -4,7 +4,8 @@ module GrandCentral
4
4
 
5
5
  def initialize initial_state, &reducer
6
6
  @state = initial_state
7
- @reducer = reducer
7
+ @reducer = reducer || proc { |state| state }
8
+ @tagged_callbacks = {}
8
9
  @dispatch_callbacks = []
9
10
  end
10
11
 
@@ -15,7 +16,13 @@ module GrandCentral
15
16
  action
16
17
  end
17
18
 
18
- def on_dispatch &block
19
+ def on_dispatch tag=nil, &block
20
+ if tag
21
+ current = @tagged_callbacks[tag]
22
+ @dispatch_callbacks.delete current if current
23
+ end
24
+
25
+ @tagged_callbacks[tag] = block
19
26
  @dispatch_callbacks << block
20
27
  self
21
28
  end
@@ -1,3 +1,3 @@
1
1
  module GrandCentral
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grand_central
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Gaskins