Rubyでファイル行数を取得する

Linuxコマンドの wc -l を使用。

count = %x{sed -n '=' #{filepath} | wc -l}.to_i
p count