[#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:105932] [Ruby master Feature#18287] Support nil value for sort in Dir.glob
From:
"Eregon (Benoit Daloze)" <noreply@...>
Date:
2021-11-04 11:32:51 UTC
List:
ruby-core #105932
Issue #18287 has been updated by Eregon (Benoit Daloze).
This is inconsistent with basically every Ruby method out there.
For all core methods, either:
* the value is converted to a boolean, and then nil/false mean the same
* the value can only be a boolean, and an ArgumentError/TypeError is raised if it's not `true` or `false`.
* `nil` has a special different meaning than true and than false (e.g., `Kernel#clone`)
I think we should fix this obvious inconsistency which seems to gain nothing.
The docs are easy to update:
> unless a falsey value is given as the optional +sort+ keyword argument.
----------------------------------------
Feature #18287: Support nil value for sort in Dir.glob
https://bugs.ruby-lang.org/issues/18287#change-94473
* Author: Strech (Sergey Fedorov)
* Status: Open
* Priority: Normal
----------------------------------------
Good day, everyone.
I would like to suggest (or question) the support of a `nil` value for `sort` argument in `Dir.glob`.
I find this behaviour a bit surprising, here is an example:
```
irb(main):001:0> Dir.glob("brace/a{.js,*}", sort: true)
=> ["brace/a.js", "brace/a", "brace/a.erb", "brace/a.html.erb", "brace/a.js", "brace/a.js.rjs"]
irb(main):001:0> Dir.glob("brace/a{.js,*}", sort: false)
=> ["brace/a.js", "brace/a.js", "brace/a.html.erb", "brace/a.erb", "brace/a.js.rjs", "brace/a"]
irb(main):001:0> Dir.glob("brace/a{.js,*}", sort: nil)
=> ["brace/a.js", "brace/a", "brace/a.erb", "brace/a.html.erb", "brace/a.js", "brace/a.js.rjs"]
```
As you can see – `sort: nil` produces the same results as `sort: true` which is confusing
Github link: https://github.com/ruby/ruby/pull/5079
Ruby spec link: https://github.com/ruby/spec/pull/894
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>