Method: Stream#remove_last

Defined in:
lib/stream.rb

#remove_lastObject

Returns a Stream which eliminates the first element of the receiver.

(1..3).create_stream.remove_last.to_a ==> [1,2]

Take a look at the source. The implementation is inefficient but elegant.



746
747
748
# File 'lib/stream.rb', line 746

def remove_last
  reverse.remove_first.reverse # I like this one
end