Mixin

Development solution that will help you write mixins the same way you write classes
Download

Mixin Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Freeware
  • Price:
  • FREE
  • Publisher Name:
  • Hersch Stevenson
  • Publisher web site:
  • http://rubyforge.org/projects/mixin
  • Operating Systems:
  • Mac OS X
  • File Size:
  • 10 KB

Mixin Tags


Mixin Description

Development solution that will help you write mixins the same way you write classes Mixin extends Module with a small, yet powerful set of features that make the experience of writing mixins more like that of writing classes when it comes to defining class methods.Typically, the way to implement a mixin that defines class methods for its includees (at least that I have noticed) is to define a module within the mixin module, usually called ClassMethods, which gets automatically extended to an including class by overwriting the mixin‘s inherited method. This technique is usually sufficient for most situations, but it has a few limitations. One of these is the fact that class attributes referenced in ClassMethods do not exist in the same scope as the enclosing mixin‘s class attributes. NOTE: Mixin is provided and licensed under the terms of the MIT/X Consortium License. Here are some key features of "Mixin": Mixin comes in handy in following situations: · When you are writing a mixin with class methods that need to access class attributes defined within the mixin module. · When you want to define a "sub-mixin" module which includes another mixin in order to expand upon its class methods in addition to its instance methods (similar to defining a hierarchy of abstract base classes). This includes calls to super to invoke a "super-mixin‘s" implementation of a given class method. · When you wish that certian module methods would get ‘inherited’ by including modules in the same manner that class methods get inherited by subclasses. · When you simply get tired of writing the same old "def self.inherited(base); base.extend(ClassMethods)" method (or some variation of it) over and over again, thereby violating the sacred DRY principle What's New in This Release: · Changed the methods 'extend_class_mixin' and 'extend_module_mixin' to 'class_extend' and 'module_extend' respectively.


Mixin Related Software