From: Gavin Sinclair Date: 2003-11-17T22:23:27+09:00 Subject: Re: Yet Another Rite Thought: method combination On Monday, November 17, 2003, 6:22:18 PM, gabriele wrote: > I just looked at matz' slides and I don't have a clear understanding > of ho9w this is suposed to work. > Possibly this has been explained verbosely, But I can't get it from > the slide. > So, this is the example: > class Foo > def foo(*args) #1 > p 'foo' > end > def foo:pre (*args ) #2 > p 'pre' > end > def foo:post (*args) #3 > p 'post' > end > def foo:wrap (*args) #4 > p 'wrap pre' > super > p 'wrap post' > end > end > now: what are pre post and wrap? > [...] > someone would please explain this to me ? The slide demonstrates it adequately. Given the above code: Foo.new.foo # Output: # wrap pre # pre # foo # post # wrap post Gavin