hacks/safe_mixin |
class Module < Object |
Example:
module Foo mixin_requires :foo, :bardef xyz # If foo and bar are not defined in the derived class, then this will # raise an exception, so it's best to know that this won't work at # load-time. foo bar end end
class Bar def foo puts "foo" end
def bar puts "bar" end
# This must come last, because foo and bar must be defined before # including Foo. If they are not defined, then an exception will be # thrown. include Foo end
Public Methods |
Require that the class/module that a mixin is being included in MUST define certain methods.
args | A list of Symbols and Integers. When a Sybmbol, indicates the given method must be defined. When an Integer, indicates the desired arity of the method indicated by the previous Symbol. |
---|