Hi,

jweirich / one.net wrote:
> ----------------------------------------------------------------------
> IV) Take advantage of blocks to do automatic closing
> 
>     ORIGINAL
>         begin
>           myfile = File.open('phonespec.txt', 'a')
>           # ...
>         ensure
>           myfile.close
>         end        file = File.open

It's not only the Ruby Way, but raises an invalid error.
If phonespec.txt cannot be open, myfile is `nil'
and cannot be closed.


    myfile = File.open('phonespec.txt', 'a')
    begin
      # ...
    ensure
      myfile.close
    end


TAKAHASHI Masayoshi