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.
8e01a4d029c6073279ae7287665d5550?d=identicon&s=25 DavidB (Guest)
on 2007-02-28 18: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.
1f2eadfb41362800ebc2cf211b91d0f7?d=identicon&s=25 javier ramirez (Guest)
on 2007-03-02 01: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!!
8e01a4d029c6073279ae7287665d5550?d=identicon&s=25 DavidB (Guest)
on 2007-03-02 17: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.