Commit 282d50c8 authored by Samuel Giddins's avatar Samuel Giddins

[PodVariant] Avoid allocating arrays in #hash

parent c8b8dcef
...@@ -38,6 +38,7 @@ module Pod ...@@ -38,6 +38,7 @@ module Pod
@test_specs = test_specs @test_specs = test_specs
@platform = platform @platform = platform
@requires_frameworks = requires_frameworks @requires_frameworks = requires_frameworks
@hash = [specs, platform, requires_frameworks].hash
end end
# @note Test specs are intentionally not included as part of the equality for pod variants since a # @note Test specs are intentionally not included as part of the equality for pod variants since a
...@@ -48,9 +49,9 @@ module Pod ...@@ -48,9 +49,9 @@ module Pod
# #
def ==(other) def ==(other)
self.class == other.class && self.class == other.class &&
specs == other.specs && requires_frameworks == other.requires_frameworks &&
platform == other.platform && platform == other.platform &&
requires_frameworks == other.requires_frameworks specs == other.specs
end end
alias_method :eql?, :== alias_method :eql?, :==
...@@ -59,9 +60,7 @@ module Pod ...@@ -59,9 +60,7 @@ module Pod
# This adds support to make instances usable as Hash keys. # This adds support to make instances usable as Hash keys.
# #
# @!visibility private # @!visibility private
def hash attr_reader :hash
[specs, platform, requires_frameworks].hash
end
end end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment