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
Schol-R-LEA;2 ELF JAM LCF BiWM MGT GS
First Speaker, Last Eristic Church of Finagle and Holy Bisexuality #define KINSEY (rand() % 7)
// Keeper of the Tent Peg of Homosexuality +5You draw it, we misinterpret it.
- Bo Lindbergh // Realitas vestri renuo, sufficioque mei."Fundamentalism, not atheism, is the ultimate rejection of faith."