class Object
def find_name(*args)
p find_method(*args)
end
def find_method(*method_names)
return self.singleton_methods(false).inject([]) do |result, method|
result.push(method.to_s) if match?(method, method_names)
result
end
end
def match?(element, array)
array.each do |a|
a = a.to_s if a.instance_of?(Object)
return true if element.match(a)
end
return false
end
end
class Object
def find_name(*args)
p find_method(*args)
end
def find_method(*method_names)
return self.singleton_methods(false).inject([]) do |result, method|
result.push(method.to_s) if match?(method, method_names)
result
end
end
def match?(element, array)
array.each do |a|
a = a.to_s if a.instance_of?(Object)
return true if element.match(a)
end
return false
end
end
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |