>>>>> "T" == TOTO  <zhoujing / comp.nus.edu.sg> writes:

T> However, I still don't understand how I can add methods to class Hash
T> with Ruby, since I don't know the internal structure of it.


pigeon% cat b.rb
#!/usr/bin/ruby
class Hash
   def insert(a, b)
      self[a] = b
   end
end

h = {1 => 2}
h.insert(2, 3)
p h
pigeon% 

pigeon% b.rb
{1=>2, 2=>3}
pigeon% 


Guy Decoux