anycable-rails 1.1.3 → 1.1.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59a60ff31ba3907089d78beaedf01b69a66ff2e7da83175dcd8e19d78bd6e9aa
|
4
|
+
data.tar.gz: 1b9a709873bf7409502c2e114b9b90ae32ce94a724d5a3091d22ea8a7c86cd76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80d3114d9eb008e7dce61d772a71608f87c0c24eb60dbed31f857abbdb7271d7a13a4a1103609910e6eef51d576a761e92f8a40cc134f3ab95b314f247e60551
|
7
|
+
data.tar.gz: cbd7a8c52da4ddd60023f536d99be251dee6158c0639744c0235b9876d4efcba9ab983ad9f06a0605cd187afaa34f2b2c1975c7b949a188e26d44860553cd88e
|
data/CHANGELOG.md
CHANGED
@@ -9,7 +9,6 @@ require "anycable/rails/session_proxy"
|
|
9
9
|
|
10
10
|
module ActionCable
|
11
11
|
module Connection
|
12
|
-
# rubocop: disable Metrics/ClassLength
|
13
12
|
class Base # :nodoc:
|
14
13
|
# We store logger tags in the connection state to be able
|
15
14
|
# to re-use them in the subsequent calls
|
@@ -98,7 +97,6 @@ module ActionCable
|
|
98
97
|
true
|
99
98
|
end
|
100
99
|
|
101
|
-
# rubocop:disable Metrics/MethodLength
|
102
100
|
def handle_channel_command(identifier, command, data)
|
103
101
|
channel = subscriptions.fetch(identifier)
|
104
102
|
case command
|
@@ -44,10 +44,54 @@ module AnyCable
|
|
44
44
|
@__istate__ ||= connection.socket.istate
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
48
|
+
module ConnectionState
|
49
|
+
module ClassMethods
|
50
|
+
def state_attr_accessor(*names)
|
51
|
+
names.each do |name|
|
52
|
+
connection_state_attributes << name
|
53
|
+
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
54
|
+
def #{name}
|
55
|
+
return @#{name} if instance_variable_defined?(:@#{name})
|
56
|
+
@#{name} = AnyCable::Rails.deserialize(__cstate__["#{name}"], json: true) if anycable_socket
|
57
|
+
end
|
58
|
+
|
59
|
+
def #{name}=(val)
|
60
|
+
__cstate__["#{name}"] = AnyCable::Rails.serialize(val, json: true) if anycable_socket
|
61
|
+
instance_variable_set(:@#{name}, val)
|
62
|
+
end
|
63
|
+
RUBY
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def connection_state_attributes
|
68
|
+
return @connection_state_attributes if instance_variable_defined?(:@connection_state_attributes)
|
69
|
+
|
70
|
+
@connection_state_attributes =
|
71
|
+
if superclass.respond_to?(:connection_state_attributes)
|
72
|
+
superclass.connection_state_attributes.dup
|
73
|
+
else
|
74
|
+
[]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.included(base)
|
80
|
+
base.extend ClassMethods
|
81
|
+
end
|
82
|
+
|
83
|
+
# Make it possible to provide istate explicitly for a connection instance
|
84
|
+
attr_writer :__cstate__
|
85
|
+
|
86
|
+
def __cstate__
|
87
|
+
@__cstate__ ||= socket.cstate
|
88
|
+
end
|
89
|
+
end
|
47
90
|
end
|
48
91
|
end
|
49
92
|
|
50
93
|
ActiveSupport.on_load(:action_cable) do
|
51
94
|
# `state_attr_accessor` must be available in Action Cable
|
95
|
+
::ActionCable::Connection::Base.include(AnyCable::Rails::ConnectionState)
|
52
96
|
::ActionCable::Channel::Base.include(AnyCable::Rails::ChannelState)
|
53
97
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anycable-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- palkan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anycable
|