Issue #6727 has been updated by alexeymuranov (Alexey Muranov).


duerst (Martin Dürst) wrote:
> On 2013/11/11 1:47, Hanmac (Hans Mackowiak) wrote:
>  
>  > i think in most cases we want something like ary[1..-1].each  but wouldnt it be better if we have an each method like
>  >
>  > each_only(1..-1) {}
>  
>  #each currently doesn't have arguments. So this could even be
>  
>  each(1..-1) {}

If #each is to take arguments,  would suggest

  [1, 2, 'a', :b, 3].each(Integer).map{|x| 2*x } # => [2, 4, 6]

----------------------------------------
Feature #6727: Add Array#rest (with implementation)
https://bugs.ruby-lang.org/issues/6727#change-42860

Author: duckinator (Nick Markwell)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor


=begin
I run into many instances where I end up using (({arr[1..-1]})), so I decided to add (({arr.rest})) to make that a bit less hideous.

Branch on github: ((<URL:https://github.com/duckinator/ruby/compare/feature/array_rest>))

Patch: ((<URL:https://github.com/duckinator/ruby/compare/feature/array_rest.patch>))

Diff: ((<URL:https://github.com/duckinator/ruby/compare/feature/array_rest.diff>))
=end


-- 
http://bugs.ruby-lang.org/