From: Henry Maddocks Date: 2012-08-12T08:37:49+09:00 Subject: Re: Unable to print a block argument. On 12/08/2012, at 12:24 AM, Ja Tse wrote: > Not sure how to put it just want to know, wat's the advantage of > creating an object through a proxy method in this case #open vs just > creating an object with the constructor Foo.new ? > You have partially implemented two patterns... Factory Method; A class method that returns an instance of the class based on the inputs. Your method always returns the same objectso there is no point creating another method to do this. Just use #new. Around Method; When accessing a resource that requires setup and tear down, eg. File open / file close, you can write a method that initialzes the resource, yields the resource to a block then clens up the resource when the block returns. Your method doesn't do this either but it's probably what you were thinking of as it is a very common Ruby pattern. Henry