class MyFile attr_reader :handle def initialize(filename) @handle = File.new(filename, "r") end def finished @handle.close endendf = MyFile.new("text.txt")puts f.handle.getsf.finished