From: Heesob Park Date: 2008-05-23T22:07:42+09:00 Subject: Re: Help extending Hash to allow hexadecimal encoded keys (problem with "Delegator") Hi, 2008/5/23 IƱaki Baz Castillo : > 2008/5/23, Heesob Park : > >> def []=(k,v) >> k = CiString.new(k) if String === k >> __getobj__[k] = v >> end >> >> def [](k) >> k = CiString.new(k) if String === k >> >> __getobj__[k] >> end >> >> def find(ifnone = nil,&blk) >> __getobj__.find(ifnone,&blk) >> end >> >> def find_all(&blk) >> __getobj__.find_all(&blk) >> end > > > > Thanks a lot, but it gives me errors: > > @uri > => {"T%61g"=>"%61liCE", "qwe"=>"qqqqqqqqqqQQQQQQQQQQQ"} > > @uri.find {|e| e[0] == "qwe" } > NoMethodError: undefined method `string' for "qwe":String > from uri.rb:72:in `==' > from (irb):6 > from (irb):6:in `find' > from uri.rb:98:in `each' > from uri.rb:98:in `find' > from uri.rb:98:in `find' > from (irb):6 > > > Unfortunatelly I have no idea of how to debug it since I don't > understand how exactly Delegator works. Any tip please? > I guess you did not try my code. I have modified eql? like this: def eql?(s) s = CiString.new(s) if String === s unescape(string.downcase).eql? unescape(s.string.downcase) end Regards, Park Heesob