From: daz Date: 2005-08-12T20:21:11+09:00 Subject: Re: Re-reading a portion of a source file from a specific point Daniel Berger wrote: > From within a Ruby program, is there a way to get Ruby to re-read itself > from a specific part of the file? > [...] > I thought perhaps there were some tricks I could > use with __DATA__, __END__ or __FILE__, but I wasn't sure. The DATA constant initially points after the __END__ marker. The origin of the DATA IO object is the script itself ! # Line 1 DATA.rewind script = DATA.readlines p script[1..2] __END__ #-> ["DATA.rewind\n", "script = DATA.readlines\n"] daz