From: Sebastian Hungerecker Date: 2010-05-16T01:19:04+09:00 Subject: Re: Hash method in ruby On 15.05.2010 17:55, Tarun Yadav wrote: > Thanks Jean, > > Can you please confirm the difference between these: > > A.class.hash #calls the hash method from Class class > > A.new.hash #calls the hash method from A(if overridden otherwise method > from Object) > > A.hash #? not able to understand what hash method is called. What kind > of object is A? > A is an object of class Class. Thusly A.class returns Class. Class is also an object of type class, but a different one, so it has a different hash code. Note that: >> A => A >> A.class => Class >> A == A.class => false >> A.class == Class => true >> A.class.hash == Class.hash => true >> A == Class => false >> A.hash == Class.hash => false >> A == A.class => false >> A.hash == A.class.hash => false