variable $INPUT_LINE_NUMBER

$INPUT_LINE_NUMBER -> Integer[permalink][rdoc][edit] [added by English]
$NR -> Integer [added by English]

$. の別名

1 e
2 f
3 g
4 h
5 i
# end of a.txt

require "English"

File.foreach(ARGV.at(0)){|line|
  # read line
}
p $INPUT_LINE_NUMBER
# end of sample.rb

ruby sample.rb a.txt
#=> 5