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=92s the standard way of implementing #hash for value objects in Ruby=
?
>
> For
>
> class A
> =A0def initialize(a, b, c)
> =A0 =A0@a, @b, @c =3D a, b, c
> =A0end
> end
>
> is it
>
> def A.hash
> =A0self.class.hash ^ @a.hash ^ @b.hash ^ @c.hash
> end
>
> or
>
> def A.hash
> =A0self.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.
>