Don’t get me wrong, I didn’t get misleaded by comments like
ActiveSupport sucks and monkey craps on too many classes
although some of this is true It has wonderful helper methods and there’s a lot of work done for you already, but ActiveSupport is simply too complex.
After I found out that
Class.class_inheritable_array fails when doing
with some undefined method exception (at least with 2.3.9), I finally decided to do it on my own.
The current implementation is simple.
You use it like
class Cat extend Hooks::InheritableAttribute inheritable_attr :lifes self.lifes = 
and in subclasses
class Garfield < Cat self.lifes << "second"
so it is like ActiveSupport’s
class_inheritable_array. Less code, of course.
Where to go?
Not sure if methods like that should be packaged in separate gems? Or in a more generic gem aggregating features?
I mean, it would end up in some big
PassiveLaziness gem and we’d have two mainlines of handy ruby feature libraries.
So where to put such code? How can we make it modular and easily useable without automatically monkey patching every second class, as ActiveSupport does?
Any thoughts welcome!