どんどん横道へ。
mkmr.rbにあったコード
f = caller[0][/in `(.*)'$/, 1]
callerはcallerを呼んだ関数を呼び出した関数の情報を配列でかえす。こんな感じ。
$ cat -n caller.rb 1 def current_method 2 p caller 3 end 4 5 def some_method 6 current_method 7 end 8 9 some_method $ ruby caller.rb ["caller.rb:6:in `some_method'", "caller.rb:9"]
上のfにはsome_methodがはいることになる。
というわけでこれはじめて知りました。
String#[regexp,fixnum]