Hi,

At Tue, 14 Mar 2006 01:01:31 +0900,
ara.t.howard / noaa.gov wrote in [ruby-talk:183918]:
> hmmm - but that (both actually) fails here:
> 
>      harp:~ > cat a.rb
>      class Module
>        def abstract_method m
>          define_method(m) do |*a|
>            defined?(super) ? super : raise(NotImplementedError, m)
>          end
>        end
>      end
> 
>      class A
>        def foo; 42; end
>      end
>      class B < A
>        abstract_method "foo"
>      end
> 
>      p B::new.foo
> 
> 
>      harp:~ > ruby a.rb
>      42

Simply separate Module#abstract_method and Class#abstract_method.

     class Class
       def abstract_method m
         define_method(m) do |*a|
           raise(NotImplementedError, m)
         end
       end
     end

-- 
Nobu Nakada