# Re: I can't believe it ate the whole thing!

**URL:** <https://www.ruby-forum.com/t/re-i-cant-believe-it-ate-the-whole-thing/60403>\
**Category:** Ruby\
**Created:** [May 13, 2006, 5:02am UTC](https://www.ruby-forum.com/t/re-i-cant-believe-it-ate-the-whole-thing/60403 "2006-05-13T05:02:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeSSSSaS\_Botp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecd19e/32.png) [@PeSSSSaS\_Botp](https://www.ruby-forum.com/u/PeSSSSaS_Botp)\
**Post date:** [May 13, 2006, 5:02am UTC](https://www.ruby-forum.com/t/re-i-cant-believe-it-ate-the-whole-thing/60403/1 "2006-05-13T05:02:44Z")

</div>

fr jeff:

# In order to do this, obviously you have to look at several lines of

the

# file, not just one at a time. After staring at the pickaxe book for

an

# hour or so, the best idea I was able to come up with was to read the

# whole file into an array using File#readlines. After that, I used

# Array#for\_each\_with\_index to zip through the array looking for the end

# of the block (being careful to watch out for inner blocks as well).

maybe, if you care to share your code, your ruby friends here may make  
it work by reading the file a line at a time…

kind regards -botp
