From: hanmac@... Date: 2018-12-20T14:46:11+00:00 Subject: [ruby-core:90644] [Ruby trunk Bug#15443] Hash#slide with infinite range gives unexpective result Issue #15443 has been updated by Hanmac (Hans Mackowiak). `Hash#slice` takes an array of keys via *keys each parameter is checked as a key in the Hash ```ruby { 1 => :a, 2 => :b, 3 => :c }.slice(2, 3) #=> { 2 => :b, 3 => :c } { 1 => :a, 2 => :b, 3 => :c }.slice([2, 3]) #=> {} [2,3] is not a key in Hash ``` There is no special Rule for Range, that's why you get {} ---------------------------------------- Bug #15443: Hash#slide with infinite range gives unexpective result https://bugs.ruby-lang.org/issues/15443#change-75810 * Author: ana06 (Ana Maria Martinez Gomez) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: trunk 2.6 * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- `{ 1 => :a, 2 => :b, 3 => :c }.slice(2..)` returns `{}`. I had expected that it retuns `{2=>:b, 3=>:c}` instead. -- https://bugs.ruby-lang.org/ Unsubscribe: