From: yermej Date: 2008-01-30T06:35:02+09:00 Subject: Re: newbie file write problem On Jan 29, 2:57 pm, Lars Zeb wrote: > f = File.new("text.txt", "w") > File.open("small.txt").each { > |line| > s = SicCode.new(line).get_sql > f.puts "#{s}" > } > f.puts "This is a string" > f.close > > The get_sql method works fine interactively when > I pass the class a string. If get_sql works in irb, it could be that the line endings in the file are throwing it off. Try using: SicCode.new(line.chomp).get_sql and see if that works.