summaryrefslogtreecommitdiff
path: root/lib/singleton.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/singleton.rb')
-rw-r--r--lib/singleton.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/singleton.rb b/lib/singleton.rb
index 30990b7..2954bfa 100644
--- a/lib/singleton.rb
+++ b/lib/singleton.rb
@@ -95,7 +95,10 @@ class << Singleton
@__instance__ = new
ensure
if @__instance__
- def self.instance; @__instance__ end
+ class <<self
+ remove_method :instance
+ def instance; @__instance__ end
+ end
else
@__instance__ = nil # failed instance creation
end
@@ -109,7 +112,10 @@ class << Singleton
@__instance__ = new
ensure
if @__instance__
- def self.instance; @__instance__ end
+ class <<self
+ remove_method :instance
+ def instance; @__instance__ end
+ end
else
@__instance__ = nil
end