def list_methods_matching name
found = []
find_methods name do |store, klass, ancestor, types, method|
if types == :instance or types == :both then
methods = store.instance_methods[ancestor]
if methods then
matches = methods.grep(/^#{Regexp.escape method.to_s}/)
matches = matches.map do |match|
"#{klass}##{match}"
end
found.push(*matches)
end
end
if types == :class or types == :both then
methods = store.class_methods[ancestor]
next unless methods
matches = methods.grep(/^#{Regexp.escape method.to_s}/)
matches = matches.map do |match|
"#{klass}::#{match}"
end
found.push(*matches)
end
end
found.uniq
end