module Eco module Language module Methods module DelegateMissing def delegate_missing_to(meth) @delegate_missing_to = meth end def method_missing(method_name, *args, **kargs, &block) super unless receiver = object_missing_delegated_to receiver.send(method_name, *args, **kargs, &block) end def respond_to_missing?(method_name, include_private = false) super end private # retrieve the delegate_missing_to object def object_missing_delegated_to return nil unless @delegate_missing_to self.method(@delegate_missing_to).call end end end end end