A
Adam Steinfurth
[Note: parts of this message were removed to make it a legal post.]
This program is very simple. It is suppose to load in the text file, load
each character into an array, then print out the array one letter at a
time. It is supposed to wait 1 second each time it prints. This freezes
every time I run it. Any ideas?
Adam
class Slow_Array
def array_split
@f = File.open('Text_for_TextReader.txt','r') do |f|
f.gets.scan(/\w/)
end
end
def print_and_wait
@f.each {
|i|
print i
sleep 1
}
end
end
#-------------------------------------------------
# Main logic
TextReader = Slow_Array.new
# Bring file into program
TextReader.array_split
# Print each character, waiting one second in between each printing
TextReader.print_and_wait
This program is very simple. It is suppose to load in the text file, load
each character into an array, then print out the array one letter at a
time. It is supposed to wait 1 second each time it prints. This freezes
every time I run it. Any ideas?
Adam
class Slow_Array
def array_split
@f = File.open('Text_for_TextReader.txt','r') do |f|
f.gets.scan(/\w/)
end
end
def print_and_wait
@f.each {
|i|
print i
sleep 1
}
end
end
#-------------------------------------------------
# Main logic
TextReader = Slow_Array.new
# Bring file into program
TextReader.array_split
# Print each character, waiting one second in between each printing
TextReader.print_and_wait