# No usage of private_class_method here module Singleton def self.included(base) base.send(:extend, ClassMethods) end module ClassMethods def instance singleton_class.send(:private, :new) unless is_private_method?(:new) @instance ||= new end private def is_private_method?(meth_name) self.private_methods.include?(meth_name) end end end class SingletonIvarWoPrivateClassMethods include Singleton def foo 12 end end singletion = SingletonIvarWoPrivateClassMethods.instance p singletion.object_id #=> 70174947355600 singleton_again = SingletonIvarWoPrivateClassMethods.instance p singleton_again.object_id #=> 70174947355600 SingletonIvarWoPrivateClassMethods.new #=> singleton_wo_private_class_method.rb:35:in `
': private method `new' # called for SingletonIvarWoPrivateClassMethods:Class (NoMethodError)