One Solution 1 def read_configuration(filename) 2 f = File.open(filename) 3 begin 4 host = f.gets 5 port = f.gets.to_i 6 ensure 7 f.close 8 end 9 end