From: Brian Candler Date: 2010-09-16T06:00:23+09:00 Subject: Re: access super from yield block? Gene Angelo wrote: >> What exactly are trying to achieve? > > I have class A that derives from class B > > A#parse and A#parse! override members of the same name in B > > A#parse and A#parse! both call A#do_parse to retrieve arguments from the > command line in a loop. A yield in A#do_parse returns the arguments > (argv). I want to call 'super argv' from both A#parse and A#parse! but > super is not set to A#super. There is no such method as A#super. super means "call the same named method in the superclass". I tried to make your example into a standalone one, but I don't know if this is a legitimate demonstration of what you're trying to do: ----- 8< ----------------------------- class B def parse(*args) puts "parse in B(#{args.inspect})" end end class A < B def parse do_parse { |a| puts "Before super" super a puts "After super" } end def do_parse yield [1,2,3] end end A.new.parse ----- 8< ----------------------------- This prints: Before super parse in B([[1, 2, 3]]) After super which is what I expect. I'm using ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux] What do you want it to do instead? -- Posted via http://www.ruby-forum.com/.