diff options
Diffstat (limited to 'lib/singleton.rb')
-rw-r--r-- | lib/singleton.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/singleton.rb b/lib/singleton.rb index 30990b79bd..2954bfa153 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 |