From: Nikolai Weibull Date: 2011-12-29T23:10:47+09:00 Subject: What’s the standard way of implementing #hash for value objects in Ruby? Hi! What’s the standard way of implementing #hash for value objects in Ruby? For class A def initialize(a, b, c) @a, @b, @c = a, b, c end end is it def A.hash self.class.hash ^ @a.hash ^ @b.hash ^ @c.hash end or def A.hash self.class.hash ^ [@a, @b, @c].hash end or is it something else? No classes in the standard library use self.class.hash, but I think it makes sense to use it.