Eric Hodel
6/2/2009 11:30:00 PM
On Jun 2, 2009, at 16:18, Suraj Kurapati wrote:
> Aaron Patterson wrote:
>> On Wed, Jun 03, 2009 at 02:01:45AM +0900, Suraj Kurapati wrote:
>>> 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.
>
> In that case, use Kernel#autoload to load your library only when the
> NFC
> constant is actually used:
>
> autoload :NFC, 'nfc'
>
> Then your users can simply write:
>
> NFC.find
You have to require 'nfc' to get the autoload, so this won't work.
Adding two files to do this is far lamer than Singleton.
If you're really dead set on it, why don't just fork it? I'm quite
certain Aaron won't care.