cable_ready 4.4.6 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +82 -78
- data/README.md +1 -1
- data/cable_ready.gemspec +1 -0
- data/lib/cable_ready.rb +9 -0
- data/lib/cable_ready/channel.rb +23 -25
- data/lib/cable_ready/channels.rb +20 -63
- data/lib/cable_ready/config.rb +68 -0
- data/lib/cable_ready/version.rb +1 -1
- data/package.json +1 -1
- data/tags +39 -34
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7306ba066c9ee64f5a46290d6f24e29e0dd55ed26869101db08f4556cd9d05d
|
4
|
+
data.tar.gz: e072e9feec793f2a64f9c4134ebf5bf31f92ac4d5075d288237f4587895bec1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3264fdb6d50c9e1d3309c8a6ff82f283546f41f47df2b5e929ab7b9180d0c4f7d6b0d25e9a88512f0c8851ccabd2a35f2b96bc4bf004fd7122b106aff9c9343
|
7
|
+
data.tar.gz: 443016a6d1020a3aae79d161e3b0dcce298ed203e8ddede5692635b49685b2a74b9b843c67593a3200c2da4a3b4cc1e756cbc616e8a6bc71622adf533ae7a995
|
data/Gemfile.lock
CHANGED
@@ -1,66 +1,67 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cable_ready (4.
|
4
|
+
cable_ready (4.5.0)
|
5
5
|
rails (>= 5.2)
|
6
|
+
thread-local (>= 1.1.0)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
|
-
actioncable (6.1.
|
11
|
-
actionpack (= 6.1.
|
12
|
-
activesupport (= 6.1.
|
11
|
+
actioncable (6.1.1)
|
12
|
+
actionpack (= 6.1.1)
|
13
|
+
activesupport (= 6.1.1)
|
13
14
|
nio4r (~> 2.0)
|
14
15
|
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailbox (6.1.
|
16
|
-
actionpack (= 6.1.
|
17
|
-
activejob (= 6.1.
|
18
|
-
activerecord (= 6.1.
|
19
|
-
activestorage (= 6.1.
|
20
|
-
activesupport (= 6.1.
|
16
|
+
actionmailbox (6.1.1)
|
17
|
+
actionpack (= 6.1.1)
|
18
|
+
activejob (= 6.1.1)
|
19
|
+
activerecord (= 6.1.1)
|
20
|
+
activestorage (= 6.1.1)
|
21
|
+
activesupport (= 6.1.1)
|
21
22
|
mail (>= 2.7.1)
|
22
|
-
actionmailer (6.1.
|
23
|
-
actionpack (= 6.1.
|
24
|
-
actionview (= 6.1.
|
25
|
-
activejob (= 6.1.
|
26
|
-
activesupport (= 6.1.
|
23
|
+
actionmailer (6.1.1)
|
24
|
+
actionpack (= 6.1.1)
|
25
|
+
actionview (= 6.1.1)
|
26
|
+
activejob (= 6.1.1)
|
27
|
+
activesupport (= 6.1.1)
|
27
28
|
mail (~> 2.5, >= 2.5.4)
|
28
29
|
rails-dom-testing (~> 2.0)
|
29
|
-
actionpack (6.1.
|
30
|
-
actionview (= 6.1.
|
31
|
-
activesupport (= 6.1.
|
30
|
+
actionpack (6.1.1)
|
31
|
+
actionview (= 6.1.1)
|
32
|
+
activesupport (= 6.1.1)
|
32
33
|
rack (~> 2.0, >= 2.0.9)
|
33
34
|
rack-test (>= 0.6.3)
|
34
35
|
rails-dom-testing (~> 2.0)
|
35
36
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
36
|
-
actiontext (6.1.
|
37
|
-
actionpack (= 6.1.
|
38
|
-
activerecord (= 6.1.
|
39
|
-
activestorage (= 6.1.
|
40
|
-
activesupport (= 6.1.
|
37
|
+
actiontext (6.1.1)
|
38
|
+
actionpack (= 6.1.1)
|
39
|
+
activerecord (= 6.1.1)
|
40
|
+
activestorage (= 6.1.1)
|
41
|
+
activesupport (= 6.1.1)
|
41
42
|
nokogiri (>= 1.8.5)
|
42
|
-
actionview (6.1.
|
43
|
-
activesupport (= 6.1.
|
43
|
+
actionview (6.1.1)
|
44
|
+
activesupport (= 6.1.1)
|
44
45
|
builder (~> 3.1)
|
45
46
|
erubi (~> 1.4)
|
46
47
|
rails-dom-testing (~> 2.0)
|
47
48
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
48
|
-
activejob (6.1.
|
49
|
-
activesupport (= 6.1.
|
49
|
+
activejob (6.1.1)
|
50
|
+
activesupport (= 6.1.1)
|
50
51
|
globalid (>= 0.3.6)
|
51
|
-
activemodel (6.1.
|
52
|
-
activesupport (= 6.1.
|
53
|
-
activerecord (6.1.
|
54
|
-
activemodel (= 6.1.
|
55
|
-
activesupport (= 6.1.
|
56
|
-
activestorage (6.1.
|
57
|
-
actionpack (= 6.1.
|
58
|
-
activejob (= 6.1.
|
59
|
-
activerecord (= 6.1.
|
60
|
-
activesupport (= 6.1.
|
52
|
+
activemodel (6.1.1)
|
53
|
+
activesupport (= 6.1.1)
|
54
|
+
activerecord (6.1.1)
|
55
|
+
activemodel (= 6.1.1)
|
56
|
+
activesupport (= 6.1.1)
|
57
|
+
activestorage (6.1.1)
|
58
|
+
actionpack (= 6.1.1)
|
59
|
+
activejob (= 6.1.1)
|
60
|
+
activerecord (= 6.1.1)
|
61
|
+
activesupport (= 6.1.1)
|
61
62
|
marcel (~> 0.3.1)
|
62
63
|
mimemagic (~> 0.3.2)
|
63
|
-
activesupport (6.1.
|
64
|
+
activesupport (6.1.1)
|
64
65
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
65
66
|
i18n (>= 1.6, < 2)
|
66
67
|
minitest (>= 5.1)
|
@@ -68,17 +69,19 @@ GEM
|
|
68
69
|
zeitwerk (~> 2.3)
|
69
70
|
addressable (2.7.0)
|
70
71
|
public_suffix (>= 2.0.2, < 5.0)
|
71
|
-
ast (2.4.
|
72
|
+
ast (2.4.2)
|
72
73
|
builder (3.2.4)
|
73
74
|
coderay (1.1.3)
|
74
|
-
concurrent-ruby (1.1.
|
75
|
+
concurrent-ruby (1.1.8)
|
75
76
|
crass (1.0.6)
|
76
77
|
erubi (1.10.0)
|
77
|
-
faraday (1.
|
78
|
+
faraday (1.3.0)
|
79
|
+
faraday-net_http (~> 1.0)
|
78
80
|
multipart-post (>= 1.2, < 3)
|
79
81
|
ruby2_keywords
|
80
82
|
faraday-http-cache (2.2.0)
|
81
83
|
faraday (>= 0.8)
|
84
|
+
faraday-net_http (1.0.1)
|
82
85
|
github_changelog_generator (1.15.2)
|
83
86
|
activesupport
|
84
87
|
faraday-http-cache
|
@@ -89,9 +92,9 @@ GEM
|
|
89
92
|
retriable (~> 3.0)
|
90
93
|
globalid (0.4.2)
|
91
94
|
activesupport (>= 4.2.0)
|
92
|
-
i18n (1.8.
|
95
|
+
i18n (1.8.7)
|
93
96
|
concurrent-ruby (~> 1.0)
|
94
|
-
loofah (2.
|
97
|
+
loofah (2.9.0)
|
95
98
|
crass (~> 1.0.2)
|
96
99
|
nokogiri (>= 1.5.9)
|
97
100
|
magic_frozen_string_literal (1.2.0)
|
@@ -102,18 +105,17 @@ GEM
|
|
102
105
|
method_source (0.9.2)
|
103
106
|
mimemagic (0.3.5)
|
104
107
|
mini_mime (1.0.2)
|
105
|
-
|
106
|
-
minitest (5.14.2)
|
108
|
+
minitest (5.14.3)
|
107
109
|
multi_json (1.15.0)
|
108
110
|
multipart-post (2.1.1)
|
109
111
|
nio4r (2.5.4)
|
110
|
-
nokogiri (1.
|
111
|
-
|
112
|
-
octokit (4.
|
112
|
+
nokogiri (1.11.1-x86_64-darwin)
|
113
|
+
racc (~> 1.4)
|
114
|
+
octokit (4.20.0)
|
113
115
|
faraday (>= 0.9)
|
114
116
|
sawyer (~> 0.8.0, >= 0.5.3)
|
115
117
|
parallel (1.20.1)
|
116
|
-
parser (
|
118
|
+
parser (3.0.0.0)
|
117
119
|
ast (~> 2.4.1)
|
118
120
|
pry (0.12.2)
|
119
121
|
coderay (~> 1.1.0)
|
@@ -121,56 +123,57 @@ GEM
|
|
121
123
|
pry-nav (0.3.0)
|
122
124
|
pry (>= 0.9.10, < 0.13.0)
|
123
125
|
public_suffix (4.0.6)
|
126
|
+
racc (1.5.2)
|
124
127
|
rack (2.2.3)
|
125
128
|
rack-test (1.1.0)
|
126
129
|
rack (>= 1.0, < 3)
|
127
|
-
rails (6.1.
|
128
|
-
actioncable (= 6.1.
|
129
|
-
actionmailbox (= 6.1.
|
130
|
-
actionmailer (= 6.1.
|
131
|
-
actionpack (= 6.1.
|
132
|
-
actiontext (= 6.1.
|
133
|
-
actionview (= 6.1.
|
134
|
-
activejob (= 6.1.
|
135
|
-
activemodel (= 6.1.
|
136
|
-
activerecord (= 6.1.
|
137
|
-
activestorage (= 6.1.
|
138
|
-
activesupport (= 6.1.
|
130
|
+
rails (6.1.1)
|
131
|
+
actioncable (= 6.1.1)
|
132
|
+
actionmailbox (= 6.1.1)
|
133
|
+
actionmailer (= 6.1.1)
|
134
|
+
actionpack (= 6.1.1)
|
135
|
+
actiontext (= 6.1.1)
|
136
|
+
actionview (= 6.1.1)
|
137
|
+
activejob (= 6.1.1)
|
138
|
+
activemodel (= 6.1.1)
|
139
|
+
activerecord (= 6.1.1)
|
140
|
+
activestorage (= 6.1.1)
|
141
|
+
activesupport (= 6.1.1)
|
139
142
|
bundler (>= 1.15.0)
|
140
|
-
railties (= 6.1.
|
143
|
+
railties (= 6.1.1)
|
141
144
|
sprockets-rails (>= 2.0.0)
|
142
145
|
rails-dom-testing (2.0.3)
|
143
146
|
activesupport (>= 4.2.0)
|
144
147
|
nokogiri (>= 1.6)
|
145
148
|
rails-html-sanitizer (1.3.0)
|
146
149
|
loofah (~> 2.3)
|
147
|
-
railties (6.1.
|
148
|
-
actionpack (= 6.1.
|
149
|
-
activesupport (= 6.1.
|
150
|
+
railties (6.1.1)
|
151
|
+
actionpack (= 6.1.1)
|
152
|
+
activesupport (= 6.1.1)
|
150
153
|
method_source
|
151
154
|
rake (>= 0.8.7)
|
152
155
|
thor (~> 1.0)
|
153
156
|
rainbow (3.0.0)
|
154
|
-
rake (13.0.
|
155
|
-
regexp_parser (2.0.
|
157
|
+
rake (13.0.3)
|
158
|
+
regexp_parser (2.0.3)
|
156
159
|
retriable (3.1.2)
|
157
160
|
rexml (3.2.4)
|
158
|
-
rubocop (1.
|
161
|
+
rubocop (1.7.0)
|
159
162
|
parallel (~> 1.10)
|
160
163
|
parser (>= 2.7.1.5)
|
161
164
|
rainbow (>= 2.2.2, < 4.0)
|
162
|
-
regexp_parser (>= 1.8)
|
165
|
+
regexp_parser (>= 1.8, < 3.0)
|
163
166
|
rexml
|
164
|
-
rubocop-ast (>= 1.
|
167
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
165
168
|
ruby-progressbar (~> 1.7)
|
166
169
|
unicode-display_width (>= 1.4.0, < 2.0)
|
167
|
-
rubocop-ast (1.
|
170
|
+
rubocop-ast (1.4.1)
|
168
171
|
parser (>= 2.7.1.5)
|
169
|
-
rubocop-performance (1.9.
|
172
|
+
rubocop-performance (1.9.2)
|
170
173
|
rubocop (>= 0.90.0, < 2.0)
|
171
174
|
rubocop-ast (>= 0.4.0)
|
172
|
-
ruby-progressbar (1.
|
173
|
-
ruby2_keywords (0.0.
|
175
|
+
ruby-progressbar (1.11.0)
|
176
|
+
ruby2_keywords (0.0.4)
|
174
177
|
sawyer (0.8.2)
|
175
178
|
addressable (>= 2.3.5)
|
176
179
|
faraday (> 0.8, < 2.0)
|
@@ -181,12 +184,13 @@ GEM
|
|
181
184
|
actionpack (>= 4.0)
|
182
185
|
activesupport (>= 4.0)
|
183
186
|
sprockets (>= 3.0.0)
|
184
|
-
standard (0.
|
185
|
-
rubocop (= 1.
|
186
|
-
rubocop-performance (= 1.9.
|
187
|
+
standard (0.11.0)
|
188
|
+
rubocop (= 1.7.0)
|
189
|
+
rubocop-performance (= 1.9.2)
|
187
190
|
standardrb (1.0.0)
|
188
191
|
standard
|
189
|
-
thor (1.0
|
192
|
+
thor (1.1.0)
|
193
|
+
thread-local (1.1.0)
|
190
194
|
tzinfo (2.0.4)
|
191
195
|
concurrent-ruby (~> 1.0)
|
192
196
|
unicode-display_width (1.7.0)
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-brightgreen.svg" target="_blank" />
|
12
12
|
</a>
|
13
13
|
<a href="http://blog.codinghorror.com/the-best-code-is-no-code-at-all/" target="_blank">
|
14
|
-
<img alt="Lines of Code" src="https://img.shields.io/badge/lines_of_code-
|
14
|
+
<img alt="Lines of Code" src="https://img.shields.io/badge/lines_of_code-663-brightgreen.svg?style=flat" />
|
15
15
|
</a>
|
16
16
|
<a href="https://cableready.stimulusreflex.com" target="_blank">
|
17
17
|
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
|
data/cable_ready.gemspec
CHANGED
@@ -15,6 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.test_files = Dir["test/**/*.rb"]
|
16
16
|
|
17
17
|
gem.add_dependency "rails", ">= 5.2"
|
18
|
+
gem.add_dependency "thread-local", ">= 1.1.0"
|
18
19
|
|
19
20
|
gem.add_development_dependency "github_changelog_generator"
|
20
21
|
gem.add_development_dependency "magic_frozen_string_literal"
|
data/lib/cable_ready.rb
CHANGED
@@ -3,9 +3,18 @@
|
|
3
3
|
require "rails/engine"
|
4
4
|
require "active_support/all"
|
5
5
|
require "cable_ready/version"
|
6
|
+
require "cable_ready/config"
|
6
7
|
require "cable_ready/broadcaster"
|
7
8
|
|
8
9
|
module CableReady
|
9
10
|
class Engine < Rails::Engine
|
10
11
|
end
|
12
|
+
|
13
|
+
def self.config
|
14
|
+
CableReady::Config.instance
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.configure
|
18
|
+
yield config
|
19
|
+
end
|
11
20
|
end
|
data/lib/cable_ready/channel.rb
CHANGED
@@ -2,48 +2,46 @@
|
|
2
2
|
|
3
3
|
module CableReady
|
4
4
|
class Channel
|
5
|
-
attr_reader :identifier, :
|
5
|
+
attr_reader :identifier, :enqueued_operations
|
6
6
|
|
7
|
-
def initialize(identifier
|
7
|
+
def initialize(identifier)
|
8
8
|
@identifier = identifier
|
9
|
-
@available_operations = available_operations
|
10
9
|
reset
|
11
|
-
|
12
|
-
define_singleton_method available_operation, &implementation
|
13
|
-
end
|
14
|
-
end
|
10
|
+
CableReady.config.operation_names.each { |name| add_operation_method name }
|
15
11
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
ActionCable.server.broadcast identifier, {"cableReady" => true, "operations" => operations}
|
20
|
-
reset if clear
|
12
|
+
config_observer = self
|
13
|
+
CableReady.config.add_observer config_observer, :add_operation_method
|
14
|
+
ObjectSpace.define_finalizer self, -> { CableReady.config.delete_observer config_observer }
|
21
15
|
end
|
22
16
|
|
23
|
-
def
|
24
|
-
|
25
|
-
operations.deep_transform_keys! { |key| key.to_s.camelize(:lower) }
|
26
|
-
identifier.broadcast_to model, {"cableReady" => true, "operations" => operations}
|
17
|
+
def broadcast(clear: true)
|
18
|
+
ActionCable.server.broadcast identifier, {"cableReady" => true, "operations" => broadcastable_operations}
|
27
19
|
reset if clear
|
28
20
|
end
|
29
21
|
|
30
|
-
def
|
31
|
-
|
22
|
+
def broadcast_to(model, clear: true)
|
23
|
+
identifier.broadcast_to model, {"cableReady" => true, "operations" => broadcastable_operations}
|
24
|
+
reset if clear
|
32
25
|
end
|
33
26
|
|
34
|
-
def
|
35
|
-
|
27
|
+
def add_operation_method(name)
|
28
|
+
return if respond_to?(name)
|
29
|
+
singleton_class.public_send :define_method, name, ->(options = {}) {
|
30
|
+
enqueued_operations[name.to_s] << options.stringify_keys
|
31
|
+
self # supports operation chaining
|
32
|
+
}
|
36
33
|
end
|
37
34
|
|
38
35
|
private
|
39
36
|
|
40
|
-
def
|
41
|
-
|
42
|
-
self
|
37
|
+
def reset
|
38
|
+
@enqueued_operations = Hash.new { |hash, key| hash[key] = [] }
|
43
39
|
end
|
44
40
|
|
45
|
-
def
|
46
|
-
|
41
|
+
def broadcastable_operations
|
42
|
+
enqueued_operations
|
43
|
+
.select { |_, list| list.present? }
|
44
|
+
.deep_transform_keys! { |key| key.to_s.camelize(:lower) }
|
47
45
|
end
|
48
46
|
end
|
49
47
|
end
|
data/lib/cable_ready/channels.rb
CHANGED
@@ -1,86 +1,43 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "thread/local"
|
3
4
|
require_relative "channel"
|
4
5
|
|
5
6
|
module CableReady
|
7
|
+
# This class is a thread local singleton: CableReady::Channels.instance
|
8
|
+
# SEE: https://github.com/socketry/thread-local/tree/master/guides/getting-started
|
6
9
|
class Channels
|
7
|
-
|
8
|
-
attr_accessor :operations
|
10
|
+
extend Thread::Local
|
9
11
|
|
10
|
-
|
11
|
-
yield CableReady::Channels.instance if block_given?
|
12
|
-
end
|
12
|
+
attr_accessor :operations
|
13
13
|
|
14
14
|
def initialize
|
15
15
|
@channels = {}
|
16
16
|
@operations = {}
|
17
|
-
%i[
|
18
|
-
add_css_class
|
19
|
-
clear_storage
|
20
|
-
console_log
|
21
|
-
dispatch_event
|
22
|
-
inner_html
|
23
|
-
insert_adjacent_html
|
24
|
-
insert_adjacent_text
|
25
|
-
morph
|
26
|
-
notification
|
27
|
-
outer_html
|
28
|
-
push_state
|
29
|
-
remove
|
30
|
-
remove_attribute
|
31
|
-
remove_css_class
|
32
|
-
remove_storage_item
|
33
|
-
set_attribute
|
34
|
-
set_cookie
|
35
|
-
set_dataset_property
|
36
|
-
set_focus
|
37
|
-
set_property
|
38
|
-
set_storage_item
|
39
|
-
set_style
|
40
|
-
set_styles
|
41
|
-
set_value
|
42
|
-
text_content
|
43
|
-
].each do |operation|
|
44
|
-
add_operation operation
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def add_operation(operation, &implementation)
|
49
|
-
@operations[operation] = implementation || ->(options = {}) { enqueue_operation(operation, options) }
|
50
17
|
end
|
51
18
|
|
52
19
|
def [](identifier)
|
53
|
-
@channels[identifier] ||= CableReady::Channel.new(identifier
|
20
|
+
@channels[identifier] ||= CableReady::Channel.new(identifier)
|
54
21
|
end
|
55
22
|
|
56
23
|
def broadcast(*identifiers, clear: true)
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
.
|
62
|
-
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
24
|
+
@channels.values
|
25
|
+
.reject { |channel| identifiers.any? && identifiers.exclude?(channel.identifier) }
|
26
|
+
.select { |channel| channel.identifier.is_a?(String) }
|
27
|
+
.tap do |channels|
|
28
|
+
channels.each { |channel| @channels[channel.identifier].broadcast(clear: clear) }
|
29
|
+
channels.each { |channel| @channels.except!(channel.identifier) if clear }
|
30
|
+
end
|
66
31
|
end
|
67
32
|
|
68
33
|
def broadcast_to(model, *identifiers, clear: true)
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
.
|
74
|
-
|
75
|
-
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
private
|
81
|
-
|
82
|
-
def mutex
|
83
|
-
@mutex ||= Mutex.new
|
34
|
+
@channels.values
|
35
|
+
.reject { |channel| identifiers.any? && identifiers.exclude?(channel.identifier) }
|
36
|
+
.reject { |channel| channel.identifier.is_a?(String) }
|
37
|
+
.tap do |channels|
|
38
|
+
channels.each { |channel| @channels[channel.identifier].broadcast_to(model, clear: clear) }
|
39
|
+
channels.each { |channel| @channels.except!(channel.identifier) if clear }
|
40
|
+
end
|
84
41
|
end
|
85
42
|
end
|
86
43
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "monitor"
|
4
|
+
require "observer"
|
5
|
+
require "singleton"
|
6
|
+
|
7
|
+
module CableReady
|
8
|
+
# This class is a process level singleton shared by all threads: CableReady::Config.instance
|
9
|
+
class Config
|
10
|
+
include MonitorMixin
|
11
|
+
include Observable
|
12
|
+
include Singleton
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
super
|
16
|
+
@operation_names = Set.new(default_operation_names)
|
17
|
+
end
|
18
|
+
|
19
|
+
def operation_names
|
20
|
+
@operation_names.to_a
|
21
|
+
end
|
22
|
+
|
23
|
+
def add_operation_name(name)
|
24
|
+
synchronize do
|
25
|
+
@operation_names << name.to_sym
|
26
|
+
notify_observers name.to_sym
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def default_operation_names
|
31
|
+
Set.new(%i[
|
32
|
+
add_css_class
|
33
|
+
append
|
34
|
+
clear_storage
|
35
|
+
console_log
|
36
|
+
dispatch_event
|
37
|
+
go
|
38
|
+
graft
|
39
|
+
inner_html
|
40
|
+
insert_adjacent_html
|
41
|
+
insert_adjacent_text
|
42
|
+
morph
|
43
|
+
notification
|
44
|
+
outer_html
|
45
|
+
play_sound
|
46
|
+
prepend
|
47
|
+
push_state
|
48
|
+
remove
|
49
|
+
remove_attribute
|
50
|
+
remove_css_class
|
51
|
+
remove_storage_item
|
52
|
+
replace
|
53
|
+
replace_state
|
54
|
+
scroll_into_view
|
55
|
+
set_attribute
|
56
|
+
set_cookie
|
57
|
+
set_dataset_property
|
58
|
+
set_focus
|
59
|
+
set_property
|
60
|
+
set_storage_item
|
61
|
+
set_style
|
62
|
+
set_styles
|
63
|
+
set_value
|
64
|
+
text_content
|
65
|
+
]).freeze
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/lib/cable_ready/version.rb
CHANGED
data/package.json
CHANGED
data/tags
CHANGED
@@ -9,49 +9,54 @@ CableReady lib/cable_ready.rb /^module CableReady$/;" m
|
|
9
9
|
CableReady lib/cable_ready/broadcaster.rb /^module CableReady$/;" m
|
10
10
|
CableReady lib/cable_ready/channel.rb /^module CableReady$/;" m
|
11
11
|
CableReady lib/cable_ready/channels.rb /^module CableReady$/;" m
|
12
|
+
CableReady lib/cable_ready/config.rb /^module CableReady$/;" m
|
12
13
|
CableReady lib/cable_ready/version.rb /^module CableReady$/;" m
|
13
14
|
Channel lib/cable_ready/channel.rb /^ class Channel$/;" c class:CableReady
|
14
15
|
Channels lib/cable_ready/channels.rb /^ class Channels$/;" c class:CableReady
|
16
|
+
Config lib/cable_ready/config.rb /^ class Config$/;" c class:CableReady
|
15
17
|
Engine lib/cable_ready.rb /^ class Engine < Rails::Engine$/;" c class:CableReady
|
16
18
|
[] lib/cable_ready/channels.rb /^ def [](identifier)$/;" f class:CableReady.Channels
|
17
|
-
|
18
|
-
|
19
|
+
add_operation_definition lib/cable_ready/config.rb /^ def add_operation_definition(name)$/;" f class:CableReady.Config
|
20
|
+
add_operation_method lib/cable_ready/channel.rb /^ def add_operation_method(name)$/;" f class:CableReady.Channel
|
21
|
+
broadcast lib/cable_ready/channel.rb /^ def broadcast(clear: true)$/;" f class:CableReady.Channel
|
19
22
|
broadcast lib/cable_ready/channels.rb /^ def broadcast(*identifiers, clear: true)$/;" f class:CableReady.Channels
|
20
|
-
broadcast_to lib/cable_ready/channel.rb /^ def broadcast_to(model, clear
|
23
|
+
broadcast_to lib/cable_ready/channel.rb /^ def broadcast_to(model, clear: true)$/;" f class:CableReady.Channel
|
21
24
|
broadcast_to lib/cable_ready/channels.rb /^ def broadcast_to(model, *identifiers, clear: true)$/;" f class:CableReady.Channels
|
25
|
+
broadcastable_operations lib/cable_ready/channel.rb /^ def broadcastable_operations$/;" f class:CableReady.Channel
|
22
26
|
cable_ready lib/cable_ready/broadcaster.rb /^ def cable_ready$/;" f class:CableReady.Broadcaster
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
const.
|
27
|
-
const.
|
28
|
-
const.color javascript/cable_ready.js /^ color: true,$/;" p
|
29
|
-
const.date javascript/cable_ready.js /^ date: true,$/;" p
|
30
|
-
const.datetime javascript/cable_ready.js /^ datetime: true,$/;" p
|
31
|
-
const.datetime-local javascript/cable_ready.js /^ 'datetime-local': true,$/;" p
|
32
|
-
const.detail javascript/cable_ready.js /^ const init = { bubbles: true, cancelable: true, detail: detail }$/;" p
|
33
|
-
const.email javascript/cable_ready.js /^ email: true,$/;" p
|
34
|
-
const.month javascript/cable_ready.js /^ month: true,$/;" p
|
35
|
-
const.number javascript/cable_ready.js /^ number: true,$/;" p
|
36
|
-
const.password javascript/cable_ready.js /^ password: true,$/;" p
|
27
|
+
config lib/cable_ready.rb /^ def self.config$/;" F class:CableReady
|
28
|
+
configure lib/cable_ready.rb /^ def self.configure$/;" F class:CableReady
|
29
|
+
const.bubbles javascript/utils.js /^ const init = { bubbles: true, cancelable: true, detail: detail }$/;" p
|
30
|
+
const.cancelable javascript/utils.js /^ const init = { bubbles: true, cancelable: true, detail: detail }$/;" p
|
31
|
+
const.detail javascript/utils.js /^ const init = { bubbles: true, cancelable: true, detail: detail }$/;" p
|
37
32
|
const.pushState javascript/cable_ready.js /^ pushState: config => {$/;" p
|
38
|
-
const.
|
39
|
-
|
40
|
-
const.select-multiple javascript/cable_ready.js /^ 'select-multiple': true,$/;" p
|
41
|
-
const.select-one javascript/cable_ready.js /^ 'select-one': true,$/;" p
|
42
|
-
const.tel javascript/cable_ready.js /^ tel: true,$/;" p
|
43
|
-
const.text javascript/cable_ready.js /^ text: true,$/;" p
|
44
|
-
const.textarea javascript/cable_ready.js /^ textarea: true,$/;" p
|
45
|
-
const.time javascript/cable_ready.js /^ time: true,$/;" p
|
46
|
-
const.url javascript/cable_ready.js /^ url: true,$/;" p
|
47
|
-
const.value javascript/cable_ready.js /^ const ignore = { value: true }$/;" p
|
48
|
-
const.week javascript/cable_ready.js /^ week: true$/;" p
|
33
|
+
const.value javascript/callbacks.js /^ const ignore = { value: true }$/;" p
|
34
|
+
default_operation_names lib/cable_ready/config.rb /^ def default_operation_names$/;" f class:CableReady.Config
|
49
35
|
dom_id lib/cable_ready/broadcaster.rb /^ def dom_id(record, prefix = nil)$/;" f class:CableReady.Broadcaster
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
36
|
+
export.INPUT javascript/enums.js /^ INPUT: true,$/;" p
|
37
|
+
export.OPTION javascript/enums.js /^ OPTION: true$/;" p
|
38
|
+
export.SELECT javascript/enums.js /^ SELECT: true$/;" p
|
39
|
+
export.TEXTAREA javascript/enums.js /^ TEXTAREA: true,$/;" p
|
40
|
+
export.color javascript/enums.js /^ color: true,$/;" p
|
41
|
+
export.date javascript/enums.js /^ date: true,$/;" p
|
42
|
+
export.datetime javascript/enums.js /^ datetime: true,$/;" p
|
43
|
+
export.datetime-local javascript/enums.js /^ 'datetime-local': true,$/;" p
|
44
|
+
export.email javascript/enums.js /^ email: true,$/;" p
|
45
|
+
export.month javascript/enums.js /^ month: true,$/;" p
|
46
|
+
export.number javascript/enums.js /^ number: true,$/;" p
|
47
|
+
export.password javascript/enums.js /^ password: true,$/;" p
|
48
|
+
export.range javascript/enums.js /^ range: true,$/;" p
|
49
|
+
export.search javascript/enums.js /^ search: true,$/;" p
|
50
|
+
export.select-multiple javascript/enums.js /^ 'select-multiple': true,$/;" p
|
51
|
+
export.select-one javascript/enums.js /^ 'select-one': true,$/;" p
|
52
|
+
export.tel javascript/enums.js /^ tel: true,$/;" p
|
53
|
+
export.text javascript/enums.js /^ text: true,$/;" p
|
54
|
+
export.textarea javascript/enums.js /^ textarea: true,$/;" p
|
55
|
+
export.time javascript/enums.js /^ time: true,$/;" p
|
56
|
+
export.url javascript/enums.js /^ url: true,$/;" p
|
57
|
+
export.week javascript/enums.js /^ week: true$/;" p
|
58
|
+
initialize lib/cable_ready/channel.rb /^ def initialize(identifier)$/;" f class:CableReady.Channel
|
55
59
|
initialize lib/cable_ready/channels.rb /^ def initialize$/;" f class:CableReady.Channels
|
56
|
-
|
60
|
+
initialize lib/cable_ready/config.rb /^ def initialize$/;" f class:CableReady.Config
|
61
|
+
operation_names lib/cable_ready/config.rb /^ def operation_names$/;" f class:CableReady.Config
|
57
62
|
reset lib/cable_ready/channel.rb /^ def reset$/;" f class:CableReady.Channel
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cable_ready
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Hopkins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thread-local
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: github_changelog_generator
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,6 +145,7 @@ files:
|
|
131
145
|
- lib/cable_ready/broadcaster.rb
|
132
146
|
- lib/cable_ready/channel.rb
|
133
147
|
- lib/cable_ready/channels.rb
|
148
|
+
- lib/cable_ready/config.rb
|
134
149
|
- lib/cable_ready/version.rb
|
135
150
|
- package.json
|
136
151
|
- tags
|
@@ -154,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
169
|
- !ruby/object:Gem::Version
|
155
170
|
version: '0'
|
156
171
|
requirements: []
|
157
|
-
rubygems_version: 3.1.
|
172
|
+
rubygems_version: 3.1.4
|
158
173
|
signing_key:
|
159
174
|
specification_version: 4
|
160
175
|
summary: Out-of-Band Server Triggered DOM Operations
|