[#106341] [Ruby master Bug#18369] users.detect(:name, "Dorian") as shorthand for users.detect { |user| user.name == "Dorian" } — dorianmariefr <noreply@...>
Issue #18369 has been reported by dorianmariefr (Dorian Mari辿).
14 messages
2021/11/30
[#106351] [Ruby master Bug#18371] Release branches (release information in general) — "tenderlovemaking (Aaron Patterson)" <noreply@...>
Issue #18371 has been reported by tenderlovemaking (Aaron Patterson).
7 messages
2021/11/30
[ruby-core:106128] [Ruby master Feature#12737] Module#defined_refinements
From:
"Eregon (Benoit Daloze)" <noreply@...>
Date:
2021-11-18 09:40:35 UTC
List:
ruby-core #106128
Issue #12737 has been updated by Eregon (Benoit Daloze).
Module#refinements seems nice and straightforward.
I think `Refinement#refined_class` is useful in any case, +1 to add that.
I slightly prefer the array variant.
Since this would be mostly used for debugging, there might not be any need to filter in many cases, i.e., the Refinement#inspect output already shows the refined_class's name, so `p M.refinements` seems typical usage (and the Hash for that case would just be more verbose).
----------------------------------------
Feature #12737: Module#defined_refinements
https://bugs.ruby-lang.org/issues/12737#change-94726
* 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: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>