While I don't know Ruby that well, a quick look at this tutorial
gives a clear solution, using a do block:
lineAccumuate = ""
File.open("output.txt", "w"), File.open("input.txt, "r").each_line do |output_file, line|
if line.scan( /^\s*\./) then
lineAccumulate += line
lineAccumulate = line
I'm not entirely sure you can double up the arguments of a block like I did here, but I gather it is possible. Also, I didn't use any error handling, as I've yet to read up on that aspect of the language.
Alternately, if you can guarantee that the input file is small enough to fit into memory, you could use File.readLines() to slurp the whole file in at once, and then walk through it using the array operators.
File.open("input.txt", "r") do |input_file|
lines = input_file.readLines
lines.each do |curr_line|
line Accumualate = ""
while curr_line.scan( /^\s*\./) do
lineAccumulate += curr_line