Issue with AspectR, Hash#[]

D

Daniel Berger

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,161
Latest member
GertrudeMa
Top