[#101179] Spectre Mitigations — Amel <amel.smajic@...>
Hi there!
5 messages
2020/12/01
[#101180] Re: Spectre Mitigations
— Chris Seaton <chris@...>
2020/12/01
I wouldn’t recommend using Ruby to run in-process untrusted code in the first place. Are people doing that?
[#101694] Ruby 3.0.0 Released — "NARUSE, Yui" <naruse@...>
We are pleased to announce the release of Ruby 3.0.0. From 2015 we
4 messages
2020/12/25
[ruby-core:101341] [Ruby master Feature#17333] Enumerable#many?
From:
masafumi.o1988@...
Date:
2020-12-09 13:56:42 UTC
List:
ruby-core #101341
Issue #17333 has been updated by okuramasafumi (Masafumi OKURA).
Here are a usecase where we could use `many?` over `count` for better performance.
https://github.com/Homebrew/brew/blob/master/Library/Homebrew/cask/audit.rb#L188
This code, `cask.artifacts.count { |k| k.is_a?(Artifact::Uninstall) } > 1` calls block as many times as the size of `cask.artifact`. In contrast, `cask.artifacts.many? { |k| k.is_a?(Artifact::Uninstall) }` calls blocks only before finding second matching artifact, which could improve performance.
Like this case where we cannot expect the size of collection, using `count` could cost a lot and introducing `many?` could help.
----------------------------------------
Feature #17333: Enumerable#many?
https://bugs.ruby-lang.org/issues/17333#change-89042
* Author: okuramasafumi (Masafumi OKURA)
* Status: Open
* Priority: Normal
----------------------------------------
`Enumerable#many?` method is implemented in ActiveSupport.
https://api.rubyonrails.org/classes/Enumerable.html#method-i-many-3F
However, it's slightly different from Ruby's core methods such as `one?` or `all?`, where they take pattern argument.
I believe these methods should behave the same so that it's easier to guess and learn.
We already have `none?`, `one?`, `any?` and `all?`, which translate into `== 0`, `== 1`, `> 0` and `== self.size`.
`many?` method translates into `> 1`, which is reasonable to exist.
Currently we need to write something this:
```ruby
[1, 2, 3].count(&:odd?) > 1
```
With `many?`, we can make it simpler:
```ruby
[1, 2, 3].many?(&:odd?)
```
Pull Request on GitHub is available at https://github.com/ruby/ruby/pull/3785
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>