Forum: Ruby on Rails Calling File.read( ) from rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
DavidB (Guest)
on 2007-02-28 19:16
(Received via mailing list)
I was looking at the encryption logic posted

http://blog.leetsoft.com/2006/03/14/simple-encryption

and http://blog.leetsoft.com/files/crypto-key.rb.txt

there is a call made to File.read( ) to open up RSA keys.
THe question is:
Does this result in an automatic closure of the file after it is
read???

 Or...... if not should I do a File.open(), perform my logic, and then
explicitly do a File.close() or wrap it in a block to close?

Concerned about a File descriptor leak.
javier ramirez (Guest)
on 2007-03-02 02:02
(Received via mailing list)
DavidB wrote:
> there is a call made to File.read( ) to open up RSA keys.
> THe question is: Does this result in an automatic closure of the file after it is 
read???
>
http://www.ruby-doc.org/core/classes/IO.html#M002297

--
--------
Estamos de estreno... si necesitas llevar el control de tus gastos
visita http://www.gastosgem.com !!Es gratis!!
DavidB (Guest)
on 2007-03-02 18:08
(Received via mailing list)
Javier,
Unbelievable-thanks for finding that. I thought I had scoured the API.
Thanks again.
David
This topic is locked and can not be replied to.