# Possible Tempfile Improvements?

**URL:** <https://www.ruby-forum.com/t/possible-tempfile-improvements/101333>\
**Category:** Ruby\
**Created:** [August 4, 2006, 10:35am UTC](https://www.ruby-forum.com/t/possible-tempfile-improvements/101333 "2006-08-04T10:35:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ian\_MacLeod](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/c6cbf5/32.png) [@Ian\_MacLeod](https://www.ruby-forum.com/u/Ian_MacLeod)\
**Post date:** [August 4, 2006, 10:35am UTC](https://www.ruby-forum.com/t/possible-tempfile-improvements/101333/1 "2006-08-04T10:35:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ian\_MacLeod](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/c6cbf5/32.png) [@Ian\_MacLeod](https://www.ruby-forum.com/u/Ian_MacLeod)\
**Post date:** [August 4, 2006, 10:47am UTC](https://www.ruby-forum.com/t/possible-tempfile-improvements/101333/2 "2006-08-04T10:47:22Z")

</div>

On 8/4/06, Ian MacLeod [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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/](http://ruby-web.org/)

Specifically your ideas reminded me of:  
[http://ruby-web.org/manual/reference-variables.html](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
