[prev in list] [next in list] [prev in thread] [next in thread]
List: ruby-talk
Subject: Re: Singleton Class or Module Functions?
From: Gavin Kistner <gavin () refinery ! com>
Date: 2004-10-21 14:47:46
Message-ID: 1FBFAB59-2370-11D9-8FDE-000A959CF5AC () refinery ! com
[Download RAW message or body]
On Oct 20, 2004, at 4:16 PM, 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?
Ah, here's a reason:
module Foo
class << self
def initialize
puts "Never called"
end
end
end
f = Foo
class Bar
include Singleton
def initialize
puts "Called the first time"
end
end
b = Bar.instance
c = Bar.instance
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic