From: Fearless Fool Date: 2011-04-16T00:40:45+09:00 Subject: Re: looking for an "inversion" pattern Thanks everybody!! @Jesús: I like your suggestion. It is simple and does what I'm looking for. @Robert K: > I am sorry, I still do not understand your motivation to have a class > method which receives an instance as first argument. My motivation is that I was writing a lot of code like this: module HasXattr def xattr_reference(key); Xattr.xattr_reference(self, key); end def xattr_store(key, value); Xattr.xattr_store(self, key, value); end def xattr_has_key?(key); Xattr.xattr_has_key?(self, key); end def xattr_delete(key); Xattr.xattr_delete(self, key); end ... end ... and I thought to myself: this is Ruby. There must be a better way. I guess I should have shown this concrete example earlier in the thread. @Kevin: > One of the problems with Ruby is that the syntax changes depending on > the compile-time or run-time context, which is a totally arbitrary > distinction. As I said, I came from a scheme background where everything was syntactically simple and life was simple. Ah, for those days. I guess I should have said "that's mighty fine Ruby-fu", since your understanding of Ruby far outstrips mine. Again, thanks all... - ff -- Posted via http://www.ruby-forum.com/.