From: "brenogazzola (Breno Gazzola)" Date: 2022-05-20T16:30:56+00:00 Subject: [ruby-core:108639] [Ruby master Bug#18793] Select and Find behave differently for hashes Issue #18793 has been reported by brenogazzola (Breno Gazzola). ---------------------------------------- Bug #18793: Select and Find behave differently for hashes https://bugs.ruby-lang.org/issues/18793 * Author: brenogazzola (Breno Gazzola) * Status: Open * Priority: Normal * ruby -v: 3.1.1 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- It seems that Hash implements select but not find, which uses the Enumerable version. ``` ruby irb(main):009:0> { 1..10 => :a, 11 .. 20 => :b }.select { _1 === 12 } => {11..20=>:b} irb(main):010:0> { 1..10 => :a, 11 .. 20 => :b }.find { _1 === 5 } => nil irb(main):011:0> { 1..10 => :a, 11 .. 20 => :b }.select { p _1 } 1..10 11..20 irb(main):012:0> { 1..10 => :a, 11 .. 20 => :b }.find { p _1 } [1..10, :a] ``` Expected Behavior: I expected that both select and find return matches OR that neither select and find return matches Current Behavior: Select returns matches but find does not. -- https://bugs.ruby-lang.org/ Unsubscribe: