22
33# :markup: markdown
44
5- require "set"
65require "active_support/rescuable"
76require "active_support/parameter_filter"
87
@@ -133,7 +132,10 @@ def action_methods
133132 # Except for public instance methods of Base and its ancestors
134133 ActionCable ::Channel ::Base . public_instance_methods ( true ) +
135134 # Be sure to include shadowed public instance methods of this class
136- public_instance_methods ( false ) ) . uniq . map ( &:to_s )
135+ public_instance_methods ( false ) -
136+ # Except the internal methods
137+ internal_methods ) . uniq
138+ methods . map! ( &:name )
137139 methods . to_set
138140 end
139141 end
@@ -146,6 +148,10 @@ def clear_action_methods! # :doc:
146148 @action_methods = nil
147149 end
148150
151+ def internal_methods
152+ super
153+ end
154+
149155 # Refresh the cached action_methods when a new action_method is added.
150156 def method_added ( name ) # :doc:
151157 super
@@ -166,6 +172,7 @@ def initialize(connection, identifier, params = {})
166172
167173 @reject_subscription = nil
168174 @subscription_confirmation_sent = nil
175+ @unsubscribed = false
169176
170177 delegate_connection_identifiers
171178 end
@@ -201,11 +208,16 @@ def subscribe_to_channel
201208 # cleanup with callbacks. This method is not intended to be called directly by
202209 # the user. Instead, override the #unsubscribed callback.
203210 def unsubscribe_from_channel # :nodoc:
211+ @unsubscribed = true
204212 run_callbacks :unsubscribe do
205213 unsubscribed
206214 end
207215 end
208216
217+ def unsubscribed? # :nodoc:
218+ @unsubscribed
219+ end
220+
209221 private
210222 # Called once a consumer has become a subscriber of the channel. Usually the
211223 # place to set up any streams you want this channel to be sending to the
0 commit comments