private_class_method

mod.private_class_method(symbol, ...) â mod
Instance Public methods

Makes existing class methods private. Often used to hide the default constructor new.

class SimpleSingleton  # Not thread safe
  private_class_method :new
  def SimpleSingleton.create(*args, &block)
    @me = new(*args, &block) if ! @me
    @me
  end
end
doc_ruby_on_rails
2015-04-19 04:03:07
Comments
Leave a Comment

Please login to continue.