Metable - The Bonus Mixin
Metable is a mixin that provides a bundle of handy methods for the aspiring ruby metaprogrammer.
Have you ever wanted an easy way to alias a class method? Check out alias_class_method. Have you ever desired a clean way to dynamically define a class method in the same manner you would an instance method using define_method ? Well feast your eyes on define_class_method. In fact, you can dynamically define a singleton method on any object the same way with define_singleton_method.
Metable provides those and many more (see the full list bellow).
Public Instance Methods
- eigen_eval
- eigenclass (aliased as metaclass)
- private_singleton_method
- protected_singleton_method
- public_singleton_method
Private Instance Methods
- alias_singleton_method
- define_singleton_method (aliased as define_public_singleton_method)
- define_private_singleton_method
- define_protected_singleton_method
Public Module Mixin & Class Mixin Methods
- class_method_defined?
- eigen_eval
- eigenclass (aliased as metaclass)
- private_class_method_defined?
- private_singleton_method
- protected_class_method
- protected_class_method_defined?
- protected_singleton_method (aliased as protected_class_method)
- public_class_method_defined?
- public_singleton_method
Private Module Mixin & Class Mixin Methods
- alias_singleton_method (aliased as alias_class_method)
- define_singleton_method (aliased as define_class_method, define_public_class_method, define_public_singleton_method)
- define_private_singleton_method (aliased as define_private_class_method)
- define_protected_singleton_method (aliased as define_protected_class_method)
- lazy_attr
Included Modules
Classes and Modules
Module Metable::ClassMethodsModule Metable::InstanceMethods