[prev in list] [next in list] [prev in thread] [next in thread]
List: ruby-talk
Subject: Re: Singleton Class or Module Functions?
From: "David A. Black" <dblack () wobblini ! net>
Date: 2004-10-21 0:44:16
Message-ID: Pine.LNX.4.44.0410201732040.26932-100000 () wobblini
[Download RAW message or body]
Hi --
On Thu, 21 Oct 2004, trans. (T. Onoma) wrote:
> I've come across this seemingly indistinct option too many times now. Which is
> better? Why choose one over the other?
>
> module ThisInstance
> class << self
> def hello
> puts "Hello World!"
> end
> end
> end
>
> ThisInstance.ameth
>
> or
>
> class This
> include Singleton
> def hello
> puts "Hello World!"
> end
> end
>
> This.instance.ameth
(Do you mean 'hello' rather than 'ameth'?)
I'm not sure what you mean. What's the connection between them?
David
--
David A. Black
dblack@wobblini.net
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic