From: "nobu (Nobuyoshi Nakada)" Date: 2012-11-20T11:48:34+09:00 Subject: [ruby-core:49632] [ruby-trunk - Feature #5448][Rejected] Singleton module's ::instance method should forward parameters Issue #5448 has been updated by nobu (Nobuyoshi Nakada). Status changed from Feedback to Rejected I think that "an extra layer of complexity where none is needed" is the parameter here. If it were really needed, you may want to use multiton instead. What you want doesn't sound singleton. ---------------------------------------- Feature #5448: Singleton module's ::instance method should forward parameters https://bugs.ruby-lang.org/issues/5448#change-33147 Author: Quintus (Marvin G��lker) Status: Rejected Priority: Normal Assignee: Category: lib Target version: next minor Hi there, Classes mixing in the Singleton module currently aren't allowed to have parameters for their initialize method. This should be changed, because sometimes it's necessary to give some initial state information to the single(ton) instance. Example code (no way to create the instance): ================================================ require "singleton" class Foo include Singleton def initialize(arg) puts "arg is: #{arg}" end end f = Foo.instance(1) #=> ArgumentError 1 for 0 f = Foo.instance #=> ArgumentError 0 for 1 ================================================ The arguments given to the ::instance method should be forwarded to #initialize, which in turn may raise the appropriate ArgumentError if necessary. ruby -v: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux] OS: Arch Linux Marvin -- http://bugs.ruby-lang.org/