>>750
たとえばこんなのとか。

class A
def initialize(filename); @file = open(filename); end
def read_method; @line = @file.gets; end
def close; @file.close unless @file.closed?; end
end

a = A.new(filename)
while a.read_method
a.kakunou
end
a.close

これだと close 忘れとかやらかしそうなんで、 A#each を定義するともっと良いかも。