grand_central 0.4.1 → 0.4.2

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: dce1305b11e550ce88f4ca24eb1131f4b433d79d
4
- data.tar.gz: 15c3e2577b61976d5d5cd0d7f62340c641c57579
3
+ metadata.gz: 0ce1be864e18e6da104f6e4e6083318879be5b2d
4
+ data.tar.gz: 0b2d0885c198e42daada1e7b6b01b266b858edac
5
5
  SHA512:
6
- metadata.gz: badc57ed5ca562c4e7ca63328131bdb4ed74bef7bc545fff08e9b01a8e9bbb2f8eb10c44eaea80445e6d903c71920971bdaecd3def235699086ab0e5c5d829d4
7
- data.tar.gz: c11dcd230ba14024bf4e3cb5615507b560ff158bc4be45e7b7205526531e42e8fbd4e115725fbcd9f6e2e6fac3fec8c54aa5a0465a2fa31ec792f2849e05f027
6
+ metadata.gz: fe753980b9b1e88591556a881c630b40c7698e1a077b52f793859d58f79511627d1f852d70bcabd5749116dacd10017832598a6edec7a42beb8a656bc7fe1e5e
7
+ data.tar.gz: 531e6e2d83ba79cd8278d78ec475c35a546ac464702a3859f8bc9cc2ffad0c5f8cfa13a79044a3d56fd0593e75edf19ac3294148f337f1497d39b3a13e072892
@@ -42,13 +42,17 @@ module GrandCentral
42
42
  end
43
43
 
44
44
  def self.call(*args)
45
- DelayedDispatch.new(self, store, []).call(*args)
45
+ self[*args].call
46
46
  end
47
47
 
48
48
  def self.[](*args)
49
49
  DelayedDispatch.new(self, store, args)
50
50
  end
51
51
 
52
+ def self.to_proc
53
+ proc { |*args| call *args.flatten(1) }
54
+ end
55
+
52
56
  # A DelayedDispatch is an object that represents a dispatch that is intended
53
57
  # to happen later. Arguments can be provided upfront, which will be used as
54
58
  # the first args to the action constructor when the dispatch occurs.
@@ -74,6 +78,10 @@ module GrandCentral
74
78
  @store.dispatch @action_class.new(*@args, *handle_bowser_event(args))
75
79
  end
76
80
 
81
+ def to_proc
82
+ proc { |*args| call *args.flatten(1) }
83
+ end
84
+
77
85
  # Add support for Bowser::Event args. This is so that front-end apps can
78
86
  # handle DOM events in a much more convenient way.
79
87
  def handle_bowser_event args
@@ -2,6 +2,12 @@ require 'set'
2
2
 
3
3
  module GrandCentral
4
4
  class Model
5
+ def self.with_attributes *attrs
6
+ klass = Class.new(self)
7
+ klass.attributes *attrs
8
+ klass
9
+ end
10
+
5
11
  def self.attributes *attrs
6
12
  @attributes ||= Set.new
7
13
  if attrs.any?
@@ -1,3 +1,3 @@
1
1
  module GrandCentral
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
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.1
4
+ version: 0.4.2
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-01-24 00:00:00.000000000 Z
11
+ date: 2017-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubyforge_project:
98
- rubygems_version: 2.5.1
98
+ rubygems_version: 2.6.8
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: State and action management for Opal apps