An interesting proof-of-concept ruby library called
Base (
source) was released last week - at least I hope it is not a serious project!.
The author describes it like this:
People love Base classes! They have tons of methods waiting to be used. Just check out ActiveRecord::Base's method list:
>> ActiveRecord::Base.methods.length
=> 530
But why stop there? Why not have even more methods? In fact, let's put every method on one Base class!
Yep, I've got to agree that many developers I've worked with love making beefy base classes.
So how does Base work? First, you create a class that inherits from Base like so:
class Utility < Base
end
and through the magic of ruby's method_missing it will effectively attach every method of every Module in its runtime environment (which will be quite a few if running under Rails, for example) to your class.
And what happens if two or more modules have the same method name? You'll get the first one that was loaded!
I like it! Now we need one database table to rule them all!