From: "matz (Yukihiro Matsumoto)" Date: 2021-12-09T07:10:32+00:00 Subject: [ruby-core:106571] [Ruby master Feature#12737] Module#defined_refinements Issue #12737 has been updated by matz (Yukihiro Matsumoto). OK, accepted. After 3.1, you can introduce: * Module#refinements * Refinment#refined_class Matz. ---------------------------------------- Feature #12737: Module#defined_refinements https://bugs.ruby-lang.org/issues/12737#change-95233 * Author: shugo (Shugo Maeda) * Status: Assigned * Priority: Normal ---------------------------------------- How about to provide Module#defined_refinements, which returns the refinements defined in the receiver as a Hash, as follows: ``` module M refine String do $M_String = self end refine Integer do $M_Integer = self end end p M.defined_refinements #=> {String => $M_String, Integer => $M_Integer} ``` By `Module#defined_refinements`, you can activate refinements globally: ``` for klass, refinement in M.defined_refinements klass.prepend(refinement) end ``` -- https://bugs.ruby-lang.org/ Unsubscribe: