0
我試圖讓從目前的方法被稱爲紅寶石元編程方法的名稱
def first_method
my_method
end
def second_method
my_method
end
def my_method
puts "called from: #{method_name}"
end
和預期產出方法的名稱:
「從名爲:first_method」
「從叫:last_method「
看到這個帖子:http://stackoverflow.com/questions/5100299/how-to-get-the-name -of-的呼法 – mcfinnigan