aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable/channel
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2016-12-22 19:16:38 +0900
committerAkira Matsuda <ronnie@dio.jp>2016-12-24 22:16:43 +0900
commit91fa2b71c3fecb26a1dc7836874478f12e6d7a02 (patch)
treede3287d0dda38a9cc3f6815f086b92d2bce1e523 /actioncable/lib/action_cable/channel
parent102ee4055770813c847c95d3d6ff8741c33597d8 (diff)
downloadrails-91fa2b71c3fecb26a1dc7836874478f12e6d7a02.tar.gz
rails-91fa2b71c3fecb26a1dc7836874478f12e6d7a02.tar.bz2
rails-91fa2b71c3fecb26a1dc7836874478f12e6d7a02.zip
Privatize unneededly protected methods in Action Cable
Diffstat (limited to 'actioncable/lib/action_cable/channel')
-rw-r--r--actioncable/lib/action_cable/channel/base.rb27
1 files changed, 13 insertions, 14 deletions
diff --git a/actioncable/lib/action_cable/channel/base.rb b/actioncable/lib/action_cable/channel/base.rb
index a866044f95..6739a62ba0 100644
--- a/actioncable/lib/action_cable/channel/base.rb
+++ b/actioncable/lib/action_cable/channel/base.rb
@@ -122,16 +122,16 @@ module ActionCable
end
end
- protected
+ private
# action_methods are cached and there is sometimes need to refresh
# them. ::clear_action_methods! allows you to do that, so next time
# you run action_methods, they will be recalculated.
- def clear_action_methods!
+ def clear_action_methods! # :doc:
@action_methods = nil
end
# Refresh the cached action_methods when a new action_method is added.
- def method_added(name)
+ def method_added(name) # :doc:
super
clear_action_methods!
end
@@ -189,22 +189,22 @@ module ActionCable
end
end
- protected
+ private
# Called once a consumer has become a subscriber of the channel. Usually the place to setup any streams
# you want this channel to be sending to the subscriber.
- def subscribed
+ def subscribed # :doc:
# Override in subclasses
end
# Called once a consumer has cut its cable connection. Can be used for cleaning up connections or marking
# users as offline or the like.
- def unsubscribed
+ def unsubscribed # :doc:
# Override in subclasses
end
# Transmit a hash of data to the subscriber. The hash will automatically be wrapped in a JSON envelope with
# the proper channel identifier marked as the recipient.
- def transmit(data, via: nil)
+ def transmit(data, via: nil) # :doc:
logger.info "#{self.class.name} transmitting #{data.inspect.truncate(300)}".tap { |m| m << " (via #{via})" if via }
payload = { channel_class: self.class.name, data: data, via: via }
@@ -213,33 +213,32 @@ module ActionCable
end
end
- def ensure_confirmation_sent
+ def ensure_confirmation_sent # :doc:
return if subscription_rejected?
@defer_subscription_confirmation_counter.decrement
transmit_subscription_confirmation unless defer_subscription_confirmation?
end
- def defer_subscription_confirmation!
+ def defer_subscription_confirmation! # :doc:
@defer_subscription_confirmation_counter.increment
end
- def defer_subscription_confirmation?
+ def defer_subscription_confirmation? # :doc:
@defer_subscription_confirmation_counter.value > 0
end
- def subscription_confirmation_sent?
+ def subscription_confirmation_sent? # :doc:
@subscription_confirmation_sent
end
- def reject
+ def reject # :doc:
@reject_subscription = true
end
- def subscription_rejected?
+ def subscription_rejected? # :doc:
@reject_subscription
end
- private
def delegate_connection_identifiers
connection.identifiers.each do |identifier|
define_singleton_method(identifier) do