From: Gunther Diemant Date: 2011-12-29T23:52:19+09:00 Subject: Re: What’s the standard way of implementing #hash for value objects in Ruby? I think you can't access instance variables from a class method, so both methods are kinda useless. 2011/12/29 Nikolai Weibull : > 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. >