On Thu, Dec 29, 2011 at 4:06 PM, Nikolai Weibull <now / bitwi.se> wrote:
> On Thu, Dec 29, 2011 at 15:52, Gunther Diemant <g.diemant / gmx.net> wrote:
>> I think you can't access instance variables from a class method, so
>> both methods are kinda useless.
>
> Ugh, that should of course be
>
> class A
> =A0def hash
> =A0 =A0 =85
> =A0end
> end

Easy way:

class A
  def hash
    [@a, @b, @c].hash
  end
end

Easiest:

# also gives you =3D=3D and eql?
A =3D Struct.new :a, :b, :c

Kind regards

robert

--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/