Bug or Feature? (proxying methods)

Y

yrashk

I have the following code:

class ReturnSelfAfter

def initialize(context)
@context = context
end

def method_missing(sym,*args,&block)
@context.send sym, *args, &block
@context
end

end

class Object
def return_self_after
ReturnSelfAfter.new(self)
end
end

While it works fine proxying most of methods (not inclusive standard
ones, of course), it seems to fail on setters:

class C ; attr_accessor :abc ; end
=> 1

While #abc returns C class instance, of course:
=> #<C:0x705014>

So, is it a bug or a feature? Or am I just missing something?

(ruby 1.8.4 (2005-12-24) [i686-darwin8.7.1])

Thank you in advance
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top