Skip to content

Commit

Permalink
Update method name
Browse files Browse the repository at this point in the history
  • Loading branch information
rsamoilov committed Jun 29, 2024
1 parent ab48c98 commit 2acbad8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/rage/cable/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
2 changes: 1 addition & 1 deletion lib/rage/cable/router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2acbad8

Please sign in to comment.