现在我的代码是这样工作的:
def method_a
self.method_b ==> 'method_b'
end
def method_b
puts self.name_of_calling_method
end
def name_of_calling_method
if /`(.*)'/.match(caller.first)
return $1
else
return nil
end
end
我怎样才能打印调用方法的名称 - 'method_a',而不是 method_b 打印'method_b'?