Pull request with the patch and tests: https://github.com/ruby/ruby/pull/19774 It has one commit for `Kernel#extend` and one for `Module#prepend`. trans (Thomas Sawyer)
# Abstract Let `Kernel#extend` and `Module#prepend` take a block. The block is evaluated in a new anonymous module, as `Module.new` evaluates its block, and the receiver is extended with, or prepended with, that module. ```ruby ...trans (Thomas Sawyer)
# Abstract Let `Module#descendants` take an optional depth, and return only the descendants that many steps from the receiver or fewer. ```ruby module A; end module B; include A; end class C; include B; end class D < C; end ...trans (Thomas Sawyer)
Shugo Maeda wrote: > Monkey-patching style has another problem that super cannot be supported in monkey patching. > ... That last line just clicked with me, and I see old problem. This only works at one level. How would one write a ref...trans (Thomas Sawyer)
This definition of `#sample` seems a bit limited. I know it aligns with the statical definition but it is very easy do another way: `shuffle.take(n)`. Also, the interface is a little odd because it can return an element or an Array. Mayb...trans (Thomas Sawyer)
Has any more thought been given to this? I had a recent request to have Ruby Facets to work as refinements, but I hesitate b/c it literally means creating a second copy of every extension method. trans (Thomas Sawyer)
It would more interesting if there were a way to declare an object mutable or not, then when immutable destructive methods would not be available.trans (Thomas Sawyer)
It would be nice if bang methods returned results that where of some additional use. Presently most just return the effected receiver. For example, currently Array#reject! works as follows: a = [1,2,3,4] a.reject!{ |x| x %...trans (Thomas Sawyer)