[prev in list] [next in list] [prev in thread] [next in thread]
List: ruby-talk
Subject: Singleton Class or Module Functions?
From: "trans. (T. Onoma)" <transami () runbox ! com>
Date: 2004-10-20 22:16:35
Message-ID: 200410201816.25521.transami () runbox ! com
[Download RAW message or body]
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
Thanks,
T.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic