Use regular memoization
`connection_gid` always return something so we don't need to use `defined?`.
This commit is contained in:
parent
ddaf3b2cb3
commit
386ab893f6
|
@ -64,17 +64,13 @@ module ActionCable
|
||||||
end
|
end
|
||||||
|
|
||||||
def connection_identifier
|
def connection_identifier
|
||||||
unless defined? @connection_identifier
|
@connection_identifier ||= connection_gid(identifiers.filter_map { |id| send(id.to_sym) if id })
|
||||||
@connection_identifier = connection_gid identifiers.filter_map { |id| send(id.to_sym) if id }
|
|
||||||
end
|
|
||||||
|
|
||||||
@connection_identifier
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def connection_gid(ids)
|
def connection_gid(ids)
|
||||||
ids.map do |o|
|
ids.map do |o|
|
||||||
if o.respond_to? :to_gid_param
|
if o.respond_to?(:to_gid_param)
|
||||||
o.to_gid_param
|
o.to_gid_param
|
||||||
else
|
else
|
||||||
o.to_s
|
o.to_s
|
||||||
|
|
Loading…
Reference in New Issue