module Test module Unit module Util module MethodOwnerFinder module_function def find(object, method_name) method = object.method(method_name) return method.owner if method.respond_to?(:owner) if /\((.+?)\)\#/ =~ method.to_s owner_name = $1 if /\A#