* [ruby-core:77215] [Ruby trunk Feature#12737] Module#defined_refinements
[not found] <redmine.issue-12737.20160908053811@ruby-lang.org>
@ 2016-09-08 5:38 ` shugo
0 siblings, 0 replies; only message in thread
From: shugo @ 2016-09-08 5:38 UTC (permalink / raw
To: ruby-core
Issue #12737 has been reported by Shugo Maeda.
----------------------------------------
Feature #12737: Module#defined_refinements
https://bugs.ruby-lang.org/issues/12737
* Author: Shugo Maeda
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
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 Module.defined_refinements #=> {String => $M_String, Integer => $M_Integer}
```
By `Module#defined_refinements`, you can activate refinements globally:
```
for klass, refinement in Module.defined_refinements
klass.prepend(refinement)
end
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-09-08 5:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <redmine.issue-12737.20160908053811@ruby-lang.org>
2016-09-08 5:38 ` [ruby-core:77215] [Ruby trunk Feature#12737] Module#defined_refinements shugo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).