From: Seebs Date: 2009-12-21T17:26:00+09:00 Subject: Re: DESTROY in ruby On 2009-12-21, Tech W. wrote: > for example, I openned a database handler in a class, and new an object > from this class, when the object go out of the scope, I want it close > the database handler automatically. so how to implement this in Ruby? > thanks again. You don't. When you're done, you close it. More likely, you build your class so that you would do something like: foo.database_get do |db| db.do_this db.do_that end and database_get closes the database handle when it's done. -s -- Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam@seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!