Randy Kramer
10/15/2007 11:16:00 AM
On Sunday 14 October 2007 09:42 pm, 7stud -- wrote:
> Here are some other possibilities that might work for you depending on
> what you're actually trying to accomplish:
>
> 1) File.rename('test.txt', 'test.aml')
>
> 2)
> require 'fileutils'
>
> FileUtils.copy('test.txt', 'test.aml')
Thanks, but the nested block is what I was looking for. What I'm writing is a
utility to convert one file format to another, and the business of copying
the file line by line is just a first iteration--eventually (well, I'm
working on that now) I'll add the code to detect certain lines or patterns
and convert them as necessary.
Irrelevant Aside: In some sense, I'm trying (or thinking I'm trying) part of
the extreme programming approach, sort of trying the simplest thing that
could possibly work. But, contrary to the way I've seen that concept
described, I'm biting off just a portion of the required functionality first,
i.e., copying one line at a time to the output file. Now I'm starting to add
the logic to examine and convert those lines, again, in little bite size
pieces (I hope. ;-)
Even More Irrelevant Aside: The thing that makes the job a little complicated
is that I can't simply convert line by line, in some cases I have to review
groups of 5 or more lines and, depending on what is there, convert those to a
smaller number of lines. But, I'm making progress.
Randy Kramer