tab_index = line.rindex("\t")
tab_index = 0 unless tab_index

tab を探して、無かったら 0 を返してほしいんだけど、nil が帰るみたいだ。
コレを一行でプログラムする手はないですか