Possible Tempfile Improvements?

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.

On 8/4/06, Ian MacLeod [email protected] wrote:

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):

Tempfile#basename (or maybe Tempfile#original_basename to avoid potential
naming conflicts down the road)

And actually, that’s all I can think of.

  • Ian MacLeod

Hi,

Have you seen:
http://ruby-web.org/

Specifically your ideas reminded me of:
http://ruby-web.org/manual/reference-variables.html
(Web::Upload#save(some_path) and Web::Upload#original_filename)

It’s a really slick little thing, especially for me since all the
servers I have to work with at work are IIS and its IIS integration is
all the way nice. (It also has apache integration which I’ve never
personally used)

Thought I’d drop the line, just in case, (:

-Harold

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs