Use regular memoization

`connection_gid` always return something so we don't need to use
`defined?`.
This commit is contained in:
Rafael Mendonça França 2021-09-23 19:23:27 -04:00
parent ddaf3b2cb3
commit 386ab893f6
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
1 changed files with 2 additions and 6 deletions

View File

@ -64,17 +64,13 @@ module ActionCable
end
def connection_identifier
unless defined? @connection_identifier
@connection_identifier = connection_gid identifiers.filter_map { |id| send(id.to_sym) if id }
end
@connection_identifier
@connection_identifier ||= connection_gid(identifiers.filter_map { |id| send(id.to_sym) if id })
end
private
def connection_gid(ids)
ids.map do |o|
if o.respond_to? :to_gid_param
if o.respond_to?(:to_gid_param)
o.to_gid_param
else
o.to_s