From: Aaron Patterson Date: 2009-06-03T05:31:06+09:00 Subject: Re: nfc 1.0.0 Released On Wed, Jun 03, 2009 at 02:01:45AM +0900, Suraj Kurapati wrote: > Aaron Patterson wrote: > > require 'nfc' > > > > # Read your tag and print the info > > p NFC.instance.find > > Seems like the NFC class includes Singleton, correct? > > require 'singleton' > class NFC > include Singleton > # ... > end > > You could simplify your public API (by not requiring users to type > .instance) like this: > > require 'singleton' > NFC = Class.new do > include Singleton > # ... > end.instance That would create a new instance of the object as soon as the gem is required, and that might not be desired. Especially when dealing with a piece of hardware. -- Aaron Patterson http://tenderlovemaking.com/