Skip to content

Commit 386ab89

Browse files
committed
Use regular memoization
`connection_gid` always return something so we don't need to use `defined?`.
1 parent ddaf3b2 commit 386ab89

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Diff for: actioncable/lib/action_cable/channel/test_case.rb

+2-6
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,13 @@ def transmit(cable_message)
6464
end
6565

6666
def connection_identifier
67-
unless defined? @connection_identifier
68-
@connection_identifier = connection_gid identifiers.filter_map { |id| send(id.to_sym) if id }
69-
end
70-
71-
@connection_identifier
67+
@connection_identifier ||= connection_gid(identifiers.filter_map { |id| send(id.to_sym) if id })
7268
end
7369

7470
private
7571
def connection_gid(ids)
7672
ids.map do |o|
77-
if o.respond_to? :to_gid_param
73+
if o.respond_to?(:to_gid_param)
7874
o.to_gid_param
7975
else
8076
o.to_s

0 commit comments

Comments
 (0)