From: Paul Brannan Date: 2002-04-10T23:04:07+09:00 Subject: Re: mix-in dependancy On Wed, Apr 10, 2002 at 10:36:52AM +0900, Yohanes Santoso wrote: > What I want is for the including to fail if A does not have #<=>. Is > there a built-in mechanism to detect this or should I do this > manually: I know of no built-in mechanism. However, RubyTreasures has something for this: http://rm-f.net/~cout/ruby/treasures/RubyTreasures-0.3/lib/hacks/safe_mixin.rb.html require 'rbt/hacks/safe_mixin' module Sort mixin_requires :<=> end class A end A.class_eval { include Sort } #=> RuntimeError: Module A does not defined method <=> (the current version of RubyTreasures raises a RuntimeError. The next version may raise a TypeError). Paul