/usr/lib/ruby/vendor_ruby/test/unit/util/method-owner-finder.rb is in ruby-test-unit 3.2.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 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#</ =~ owner_name
ObjectSpace.each_object(Module) do |mod|
return mod if mod.to_s == owner_name
end
else
owner_name.split(/::/).inject(Object) do |parent, name|
parent.const_get(name)
end
end
else
object.class
end
end
end
end
end
end
|