# Is File.open deprecated?

**URL:** <https://www.ruby-forum.com/t/is-file-open-deprecated/181184>\
**Category:** Ruby\
**Created:** [January 7, 2010, 1:30am UTC](https://www.ruby-forum.com/t/is-file-open-deprecated/181184 "2010-01-07T01:30:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [January 7, 2010, 1:30am UTC](https://www.ruby-forum.com/t/is-file-open-deprecated/181184/1 "2010-01-07T01:30:41Z")

</div>

I don’t see it mentioned in the File chapter of the latest Pickaxe book?  
Is  
this just a mistake? I would think it would be mentioned as deprecated  
otherwise…??? Apparently I use File.new instead, but it seems like  
File.open  
is worth leaving around…?

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [January 7, 2010, 1:34am UTC](https://www.ruby-forum.com/t/is-file-open-deprecated/181184/2 "2010-01-07T01:34:11Z")

</div>

Xeno C. wrote:

> I don’t see it mentioned in the File chapter of the latest Pickaxe  
> book? Is this just a mistake? I would think it would be mentioned as  
> deprecated otherwise…??? Apparently I use File.new instead, but it  
> seems like File.open is worth leaving around…?  
> It looks like the answer of my question is on page 162. Apparently it  
> still is  
> in use as a regular class method, and works a little differently from  
> “new”, and  
> just got left out of the main “File” method definitions.

I am interested in any further comments on this that can reaffirm my  
sanity in  
this matter.

xc

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [January 7, 2010, 1:59am UTC](https://www.ruby-forum.com/t/is-file-open-deprecated/181184/3 "2010-01-07T01:59:57Z")

</div>

Rick DeNatale wrote:

> 

No, it’s not on my page 549. I’ve got instance methods pid through putc  
on that  
page, and open nowhere to be found…

Ah, wait, it’s a class method not an instance method: IT’s on Page 540  
in this  
edition (Programming Ruby 1.9).

xc

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [January 7, 2010, 1:37am UTC](https://www.ruby-forum.com/t/is-file-open-deprecated/181184/4 "2010-01-07T01:37:42Z")

</div>

On Wed, Jan 6, 2010 at 7:30 PM, Xeno C.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I don’t see it mentioned in the File chapter of the latest Pickaxe book? Is  
> this just a mistake? I would think it would be mentioned as deprecated  
> otherwise…??? Apparently I use File.new instead, but it seems like  
> File.open is worth leaving around…?

It’s actually IO.open, and File which is a subclass of IO inherits it.

It’s documented on page 549.

–  
Rick DeNatale

Blog: [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)  
Twitter: [http://twitter.com/RickDeNatale](http://twitter.com/RickDeNatale)  
WWR: [http://www.workingwithrails.com/person/9021-rick-denatale](http://www.workingwithrails.com/person/9021-rick-denatale)  
LinkedIn: [Rick DeNatale - Developer - IBM | LinkedIn](http://www.linkedin.com/in/rickdenatale)

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [January 7, 2010, 3:38am UTC](https://www.ruby-forum.com/t/is-file-open-deprecated/181184/5 "2010-01-07T03:38:18Z")

</div>

It’s page 549 of the PDF version, my dead tree version is upstairs.

On Wed, Jan 6, 2010 at 7:59 PM, Xeno C.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > 
> 
> xc
> 
> –  
> “It’s the preponderance, stupid!” - Professor Stephen Schneider, IPCC member

–  
Rick DeNatale

Blog: [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)  
Twitter: [http://twitter.com/RickDeNatale](http://twitter.com/RickDeNatale)  
WWR: [http://www.workingwithrails.com/person/9021-rick-denatale](http://www.workingwithrails.com/person/9021-rick-denatale)  
LinkedIn: [Rick DeNatale - Developer - IBM | LinkedIn](http://www.linkedin.com/in/rickdenatale)
