Jess Gabriel y Galn wrote in post #1134629:
>
> Essentially they are the same as object instance variables, it's just
> that the object they belong to happens to be a class. Remember that
> classes are objects. You just need to be aware of what object is self
> at any point and everything just falls into place.
>
Thanks, I wrote this down in my booklet and started using puts
self.inspect everywhere :)

>
> The best way is to have a default proc for the hash that creates the
> array and assigns it to missing keys, then you just append:
>
> hash = Hash.new {|h,k| h[k] = []}
>
> hash[self.class] << self
>

This is beautiful ! I didn't know you can put proc behind Hash.new

From the ruby-doc.org: Hash.new {|hash, key| block } вк new_hash

h = Hash.new { |hash, key| hash[key] = "Go Fish: #{key}" }
h["c"]           #=> "Go Fish: c"
h["c"].upcase!   #=> "GO FISH: C"
h["d"]           #=> "Go Fish: d"
h.keys           #=> ["c", "d"]

I see in docs you can also do similar behind Array.new, very useful
stuff, thanks again to everyone !