abrandoned / heredity

gem to provide class inheritable attributes outside of rails and other framework integrated mechanisms
MIT License
1 stars 3 forks source link

Add the ability the define inherited hooks. #2

Closed liveh2o closed 11 years ago

liveh2o commented 11 years ago

Creating inheritance hooks that play well with others (e.g. don't clobber inheritance that are already defined) requires injecting inheritance hooks into the Class class (via extend). This works pretty well, but requires a lot of setup when typically, only a few lines need to be executed (i.e. eval'd) on the subclass.

To simplify this add, an on_inherited method that captures code and executes when the class is inherited.

abrandoned commented 11 years ago

:shipit: