grand_central 0.3.3 → 0.4.0

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: a9e3e025cca4929bf9470cf1b23b12e6f65620bf
4
- data.tar.gz: 6c5d0cfc19ca3839a152ced449b7a61a4cccbe71
3
+ metadata.gz: 076a50df9e774bbc0dafcd67d1a1449477f780a3
4
+ data.tar.gz: 8fbe1ac8815fccd5fd783bd3167d8775120dc71a
5
5
  SHA512:
6
- metadata.gz: d0c0af0cf9865619dc17e02581286a314d1f635132e2d45a17efd69b2a1fa0d3386ad41259d897b1a451e5b938cd4ef6b5f6b1765597325e257582cbbb9953cb
7
- data.tar.gz: a748b3a1d8d7c204134efdadf7fa3c0938bbf390fa5727e65c087a89b238bc1aabbe7d9f3a233754000b5ea7907a3e81eccbad9b43186595e9b430c0d63429a4
6
+ metadata.gz: 5355f8d1d710a5237ccb82c4d8706433bca6c93f22f4080f1d58b36973f058014cea226e4a5236226af6f8c9aa5c90a893b8d7d7c55e1cf30725a451e5f9bc41
7
+ data.tar.gz: aa618718dcf32a968ba6cb08422001bb51881ce4ce6bafa315a8b3e981b517d34ddaa140f446fcbfc5277f331f67f33168335a2e8a0d88bdfe1978cd01e88b66
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,13 +1,74 @@
1
- # Contributor Code of Conduct
1
+ # Contributor Covenant Code of Conduct
2
2
 
3
- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
3
+ ## Our Pledge
4
4
 
5
- We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
6
11
 
7
- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
12
+ ## Our Standards
8
13
 
9
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
10
16
 
11
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
12
22
 
13
- This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at jgaskins@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
@@ -28,5 +28,81 @@ module GrandCentral
28
28
  def always &block
29
29
  promise.always &block
30
30
  end
31
+
32
+ class << self
33
+ attr_writer :store
34
+ end
35
+
36
+ def self.store
37
+ if self == Action
38
+ @store
39
+ else
40
+ @store || superclass.store
41
+ end
42
+ end
43
+
44
+ def self.call(*args)
45
+ DelayedDispatch.new(self, store, []).call(*args)
46
+ end
47
+
48
+ def self.[](*args)
49
+ DelayedDispatch.new(self, store, args)
50
+ end
51
+
52
+ # A DelayedDispatch is an object that represents a dispatch that is intended
53
+ # to happen later. Arguments can be provided upfront, which will be used as
54
+ # the first args to the action constructor when the dispatch occurs.
55
+ #
56
+ # When you `call` the DelayedDispatch, the arguments given to `call` are
57
+ # used as the remaining arguments to the action constructor. The action is
58
+ # created and dispatched to the specified store.
59
+ #
60
+ # If you're familiar with functional programming, this is really just a
61
+ # curried `Action.call`, where the currying only happens once.
62
+ class DelayedDispatch
63
+ def initialize action_class, store, args
64
+ @action_class = action_class
65
+ @store = store
66
+ @args = args
67
+
68
+ if store.nil?
69
+ raise ArgumentError, "No store set for #{action_class}"
70
+ end
71
+ end
72
+
73
+ def call *args
74
+ @store.dispatch @action_class.new(*@args, *handle_bowser_event(args))
75
+ end
76
+
77
+ # Add support for Bowser::Event args. This is so that front-end apps can
78
+ # handle DOM events in a much more convenient way.
79
+ def handle_bowser_event args
80
+ unless RUBY_ENGINE == 'opal'
81
+ return args
82
+ end
83
+
84
+ if args.first.class.name == 'Bowser::Event'
85
+ event = args.first
86
+ case event.type
87
+ when 'submit'
88
+ # We're modifying a value we received, which is usually a no-no, but
89
+ # in this case it's the most pragmatic solution I can think of.
90
+ event.prevent
91
+ when 'input'
92
+ event.target.value
93
+ when 'change'
94
+ element = event.target
95
+
96
+ # In hindsight, using Element#type for the tag type was a bad idea.
97
+ # It means we need to dip into JS to get the damn type property.
98
+ if element.type == 'input' && `#{element.to_n}.type` == 'checkbox'
99
+ element.checked?
100
+ else
101
+ element.value
102
+ end
103
+ end
104
+ end
105
+ end
106
+ end
31
107
  end
32
108
  end
@@ -0,0 +1,16 @@
1
+ require "grand_central/model"
2
+
3
+ module GrandCentral
4
+ class Model
5
+ module Subscriptable
6
+ def merge(other)
7
+ update(other)
8
+ end
9
+
10
+ def [](attr)
11
+ send(attr)
12
+ end
13
+ end
14
+ end
15
+ end
16
+
@@ -1,3 +1,3 @@
1
1
  module GrandCentral
2
- VERSION = "0.3.3"
2
+ VERSION = "0.4.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.3.3
4
+ version: 0.4.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: 2016-08-22 00:00:00.000000000 Z
11
+ date: 2017-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,6 +72,7 @@ files:
72
72
  - lib/grand_central.rb
73
73
  - lib/grand_central/action.rb
74
74
  - lib/grand_central/model.rb
75
+ - lib/grand_central/model/subscriptable.rb
75
76
  - lib/grand_central/store.rb
76
77
  - lib/grand_central/version.rb
77
78
  - lib/grand_central/versioned_store.rb
@@ -94,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  version: '0'
95
96
  requirements: []
96
97
  rubyforge_project:
97
- rubygems_version: 2.6.6
98
+ rubygems_version: 2.6.8
98
99
  signing_key:
99
100
  specification_version: 4
100
101
  summary: State and action management for Opal apps