From: Robert Klemme Date: 2010-01-21T20:50:10+09:00 Subject: Re: Ruby equivalent of C# "using keword" and IDispose 2010/1/21 Peter Alvin : > What is the most expedient way to do this C# construct in Ruby? > > C#: using (myObj = new MyClass()) { >    // misc code here > } //MyClass.Dispose automatically called here > > I wish to put stuff in MyClass.Dispose() to release resources... it must > always be called. You want "ensure". See http://blog.rubybestpractices.com/posts/rklemme/001-Using_blocks_for_Robustness.html http://blog.rubybestpractices.com/posts/rklemme/002_Writing_Block_Methods.html Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/