Issue #4910 has been updated by mame (Yusuke Endoh).

Target version set to next minor


----------------------------------------
Feature #4910: Classes as factories
https://bugs.ruby-lang.org/issues/4910#change-33241

Author: rklemme (Robert Klemme)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: 
Target version: next minor


I suggest to add these two to class Class:

class Class
  alias call new

  def to_proc(*args)
    lambda {|*a| new(*args)}
  end
end

Then we can use class instances where blocks are needed and can easily use them as factory instances using the general contract of #call (see example attached).


-- 
http://bugs.ruby-lang.org/