Hi --

On Fri, 19 Mar 2004, Aredridel wrote:

> 	def foo
> 		puts "outer"
> 	end
> 
> 	class Bar
> 		def foo
> 			"inner"
> 		end
> 	end
> 
> 	Bar.new.foo # => "inner"
> 	foo # => "outer"
> 
> 	class Bar
> 		def foo
> 			super
> 		end
> 	end
> 
> 	Bar.new.foo # => "inner"

That should be "outer", I think :-)

My only problem with the 'super' approach is that it doesn't really
execute the top-level version of the method; it executes the next
version up in the method search path, which may or may not be the
top-level version.

  def x
    puts "Top level"
  end

  class A
    def x
      puts "A#x"
    end
  end

  class B < A
    def x
      super
    end
  end

  B.new.x    # => A#x


So it's not a reliable way of reaching back to the top level.


David

-- 
David A. Black
dblack / wobblini.net