On Mon, 13 Mar 2006, kwatch wrote: > ara.t.how... / noaa.gov wrote: >> class Module >> def abstract_method m >> define_method(m){|*a| super rescue raise NotImplementedError} >> end >> end > > It seems to be a good solution. > I'll consider and examine this idea. > Thanks ara. sure. this one's a bit more robust since it doesn't mask errors: harp:~ > cat a.rb class Module def abstract_method m define_method(m) do |*a| begin; super; rescue NoMethodError; raise NotImplementedError, m; end end end end module Interface abstract_method :foo def bar; foo end end class C def foo; "C#foo" end end class D < C include Interface end p D::new.foo harp:~ > ruby a.rb "C#foo" regards. -a -- share your knowledge. it's a way to achieve immortality. - h.h. the 14th dali lama