[Source]
# File lib/singleton.rb, line 133 133: def _load(str) 134: instance 135: end
properly clone the Singleton pattern - did you know that duping doesn‘t copy class methods?
# File lib/singleton.rb, line 129 129: def clone 130: Singleton.__init__(super) 131: end
waiting-loop hook
# File lib/singleton.rb, line 146 146: def _instantiate?() 147: while false.equal?(@__instance__) 148: Thread.critical = false 149: sleep(0.08) # timeout 150: Thread.critical = true 151: end 152: @__instance__ 153: end
ensure that the Singleton pattern is properly inherited
# File lib/singleton.rb, line 140 140: def inherited(sub_klass) 141: super 142: Singleton.__init__(sub_klass) 143: end
[Validate]