On Tue, May 10, 2011 at 11:16 PM, Greg Hacke <greghacke / gmail.com> wrote:
>
> This obviously goes off without a hitch. Now, I need to find and replace
> three specific values within the file itself.
>
> So within the file we have:
>
> Record for {username} with {email} from {country}
>
> =A0I've read through a ton of material and am looking for the best method=
.
> Here are a few caveats:
> I don't need a temp file.
> I am unconcerned with overwriting the username.txt file with itself.
> I have to replace three values within the file.

How about using ERB and a template?

http://ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html

Load the template, substitute the values in your template with what's
user specific, and write the template out to the path you want?

That way, you don't have to copy, don't need a tempfile, and can scale
up to any amount of users. ;)

--=20
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.