On Mar 20, 2011, at 5:10 PM, Anurag Priyam wrote:

> On Mon, Mar 21, 2011 at 2:25 AM, Justin D. <justin.domingue / hotmail.com 
> > wrote:
> [...]
>> Does File.open opens in "r" or "w"?
>
> It is easier to refer docs for such questions :).
>
> $ ri File.open
>
> (from ruby core)
> ------------------------------------------------------------------------------
>  File.open(filename, mode="r" [, opt])                 -> file
>  File.open(filename [, mode [, perm]] [, opt])         -> file
>  File.open(filename, mode="r" [, opt]) {|file| block } -> obj
>  File.open(filename [, mode [, perm]] [, opt]) {|file| block } -> obj
>
> Hence, 'r'.
>
> -- 
> Anurag Priyam
> http://about.me/yeban/
>


...But if you need 'w', you can specify the mode yourself rather than  
taking the default value.

-Rob

Rob Biedenharn		
Rob / AgileConsultingLLC.com	http://AgileConsultingLLC.com/
rab / GaslightSoftware.com		http://GaslightSoftware.com/