Joerg Diekmann wrote:
> Hi - not sure if this is possible - but it feels like it could be with
> some serious ruby-fu.
>
> I have the following:
>
> class A
>   def method1
>     method2
>   end
>
>   def method2
>     return 100
>   end
> end
>
> class B < A
>   def method1
>     super
>   end
>
>   def method2
>     return 200
>   end
> end
>
>
> This is what happens:
>
> b.method1 # 200
>
> But, what I want is:
>
> b.method1 # 100
>
>
> Is this possible at all?

Local methods would do the trick. We don't have those. But here's a
cool way:

  require 'facets'
  require 'kernel/as'

  class A

    def method1
      as(A).method2
    end

    def method2
      return 100
    end

  end

  class B < A
    def method1
      super
    end

    def method2
      return 200
    end
  end

T.

(http://facets.rubyforge.org)