Daniel Berger
4/26/2006 4:15:00 AM
Hi all,
Ruby 1.8.4
AspectR 0.3.5
I'm having trouble wrapping Hash#[] with AspectR. As a sanity check I
wrote this:
require 'aspectr'
include AspectR
class SymAspect < Aspect
def pre(method, object, exit_status, *args)
puts "In the pre method"
end
end
SymAspect.new.wrap(Hash, :pre, nil, :keys)
h = {'foo', 1, 'bar', 2}
h.keys # "In the pre method"
Ok, that worked as expected. However, this does not:
SymAspect.new.wrap(Hash, :pre, nil, :[])
h = {'foo', 1, 'bar', 2}
h['foo'] # nothing - why?
What's going on? Any insight appreciated.
Thanks,
Dan