grand_central 0.4.5 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d89985779de6877bfd2305c518eefca3795ac375
4
- data.tar.gz: 126a69289fd53017d1fccac2b0ad7fd3aa1f844b
3
+ metadata.gz: 4bab60b41f78d368a46d6f5f50411b9ff3e4c1e1
4
+ data.tar.gz: 162f18b085499204b190ed07b4b12e3fec03e538
5
5
  SHA512:
6
- metadata.gz: 561effda17e8a6e625afc5fa97e0ad6e9d046477db7f2029a4d0640ad7cd1e38ef2c87980628f6df63f413c024057b5837d81c80df0ca410e4db0cf30d8eecd8
7
- data.tar.gz: 5bc65ebb93915022805611292c9972e45ef47ea3f73251819a21c7bcb018d0c3df35b088e22b7e9c647b39e2055400ac6bb6d4a1ca05c166c5fd4e8b67a8dd11
6
+ metadata.gz: 5f2abc49d9c520540967964f8c6f7badf979c80ec322dba655e69f8fcc8d9ff063d2b867cb1b47f5bdf8954c935a157ed2083f01f95b336af5452c459cb0c0f7
7
+ data.tar.gz: 0e9922a471ad8e7392f48b68bec976edb67b1ea13867cf6b87436baaabee01ed3ee98727a940613d1ae47b3dbc58ddf8bdcc949dbbcfc8696bdf33597ef134ec
@@ -46,7 +46,7 @@ module GrandCentral
46
46
  end
47
47
 
48
48
  def self.[](*args)
49
- DelayedDispatch.new(self, store, args)
49
+ DelayedDispatch.new(self, args)
50
50
  end
51
51
 
52
52
  def self.to_proc
@@ -62,24 +62,28 @@ module GrandCentral
62
62
  # created and dispatched to the specified store.
63
63
  #
64
64
  # If you're familiar with functional programming, this is really just a
65
- # curried `Action.call`, where the currying only happens once.
65
+ # curried `Action.call`, except the invocation is explicit rather than
66
+ # happening automatically when all of the arguments have been received.
66
67
  class DelayedDispatch
67
- def initialize action_class, store, args
68
+ def initialize action_class, args
68
69
  @action_class = action_class
69
- @store = store
70
70
  @args = args
71
+ end
71
72
 
73
+ def call *args
72
74
  if store.nil?
73
75
  raise ArgumentError, "No store set for #{action_class}"
74
76
  end
75
- end
76
77
 
77
- def call *args
78
- @store.dispatch @action_class.new(*handle_bowser_event(@args + args))
78
+ store.dispatch @action_class.new(*handle_bowser_event(@args + args))
79
79
  end
80
80
 
81
81
  def [] *args
82
- self.class.new @action_class, @store, @args + args
82
+ self.class.new @action_class, @args + args
83
+ end
84
+
85
+ def store
86
+ @action_class.store
83
87
  end
84
88
 
85
89
  def to_proc
@@ -1,3 +1,3 @@
1
1
  module GrandCentral
2
- VERSION = "0.4.5"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grand_central
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Gaskins
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-10 00:00:00.000000000 Z
11
+ date: 2017-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler