I think you can't access instance variables from a class method, so
both methods are kinda useless.

2011/12/29 Nikolai Weibull <now / bitwi.se>:
> Hi!
>
> What√‘ the standard way of implementing #hash for value objects in Ruby?
>
> For
>
> class A
> ef initialize(a, b, c)
> a, @b, @c = a, b, c
> nd
> end
>
> is it
>
> def A.hash
> elf.class.hash ^ @a.hash ^ @b.hash ^ @c.hash
> end
>
> or
>
> def A.hash
> elf.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.
>