From 2acbad836abed297e8edad91cd995939961de29b Mon Sep 17 00:00:00 2001 From: Roman Samoilov <2270393+rsamoilov@users.noreply.github.com> Date: Sat, 29 Jun 2024 11:52:58 +0100 Subject: [PATCH] Update method name --- lib/rage/cable/channel.rb | 7 ++++--- lib/rage/cable/router.rb | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/rage/cable/channel.rb b/lib/rage/cable/channel.rb index 9f41e547..b3dd85fd 100644 --- a/lib/rage/cable/channel.rb +++ b/lib/rage/cable/channel.rb @@ -12,20 +12,21 @@ class << self attr_reader :__channels # @private - def __prepare_actions + # returns a list of actions that can be called remotely + def __register_actions actions = ( public_instance_methods(true) - Rage::Cable::Channel.public_instance_methods(true) ).reject { |m| m.start_with?("__rage_tmp") || m.start_with?("__run") } @__prepared_actions = (INTERNAL_ACTIONS + actions).each_with_object({}) do |action_name, memo| - memo[action_name] = __prepare_action_proc(action_name) + memo[action_name] = __register_action_proc(action_name) end actions - INTERNAL_ACTIONS end # @private - def __prepare_action_proc(action_name) + def __register_action_proc(action_name) if action_name == :subscribed && @__hooks before_subscribe_chunk = if @__hooks[:before_subscribe] lines = @__hooks[:before_subscribe].map do |h| diff --git a/lib/rage/cable/router.rb b/lib/rage/cable/router.rb index 55a82329..493174f6 100644 --- a/lib/rage/cable/router.rb +++ b/lib/rage/cable/router.rb @@ -50,7 +50,7 @@ def process_subscription(connection, identifier, channel_name, params) return :invalid end - klass.__prepare_actions.tap do |available_actions| + klass.__register_actions.tap do |available_actions| Rage.cable.debug_log { "Compiled #{channel_name}. Available remote actions: #{available_actions}." } end