2015-06-03 Ruby でコールスタックを取得する Ruby Ruby でメソッドのコールスタックを取得したい場合 Kernel.#caller メソッドが利用できます。 [コード] def test1 p caller end def test2 test1 end test2 [出力] ["/mnt/sub/ruby/test/caller/main.rb:6:in `test2'", "/mnt/sub/ruby/test/caller/main.rb:9:in `<main>'"]