“The universal base class you always wanted”, from Gary Bernhardt.
From the lib:
def self.call_method(object, name, args, block) name_string = name.to_s all_modules.each do |mod| if mod.respond_to?(name) return mod.send name, *args, &block elsif mod.instance_methods.include?(name_string) return call_instance_method(mod, name, args, block) end end # 1. The world is all that is the case. # 2. We failed to find a method to call. # 2.1. So we need to call method_missing. # 2.1.1. We can't just super it because we're not in method_missing. # 126.96.36.199. We're not in method_missing because there are two of them # (self and instance) that need to share this code. # 188.8.131.52. We need to call the method that would be called if we said # "super" in the object's method_missing. # 184.108.40.206.1. Which is its class's superclass's method_missing method # object. Object.instance_method(:method_missing).bind(object).call(name, *args, &block) end