Speedup: calculate Item#hash once

This commit is contained in:
josh committed 2025-07-27 13:48:52 -04:00
1 parent 91f476187b
commit b371f4b404
1 file changed
+2 -1
+2 -1
View File
@@ -22,6 +22,7 @@ class Propane
def initialize(rule, position)
@rule = rule
@position = position
@_hash = [@rule, @position].hash
end
# Hash function.
@@ -29,7 +30,7 @@ class Propane
# @return [Integer]
# Hash code.
def hash
[@rule, @position].hash
@_hash
end
# Compare Item objects.