Hey, new here. I've been mucking about with Tempfile lately, mainly in
regards to using Ruby for web-coding. So with it in mind that I'm focusing
on Tempfile from that angle, here are some quick improvements I'd like to
propose:
Tempfile#store(path):
This would close the tempfile, and move (rename) it to the path given as
an argument. Now, a couple options arise after that (that I can think of),
it could either 1) reopen the file pointer at the new path, 2) return a new
filepointer that's opened at that path, or 3) keep the Tempfile pointer
closed. Another note would be that the function might perhaps be named a
more fitting: "Tempfile#store!".
Tempfile#basename (or maybe Tempfile#original_basename to avoid potential
naming conflicts down the road)
Just an attribute to hold the basename that was originally passed into the
tempfile. This keeps people from parsing the basename out of the Tempfile's
name (in case the naming scheme changes down the road), and generally makes
things easier when you want to use store() as outlined above
And actually, that's all I can think of.
···
--
- Ian MacLeod