From: Ralph Shnelvar Date: 2010-02-04T11:38:58+09:00 Subject: hooking subscript operations in a hash In order to help debug something, I'd like to hook the hash subscript operation. I've tried this (and several variants) in irb ... but it doesn't do what I want it to. module RalphMod def []=(index, value) p index p value if index == 'PATH_INFO' and value == '/undefined' puts 'found it!' end super index, value end end class Hash extend RalphMod end env = {} env['X'] = 'Y' env['PATH_INFO'] = '/undefined' The values are not displayed and 'found it!' is also not displayed.