Class Array
In: lib/powerpack/array/butlast.rb
lib/powerpack/array/butfirst.rb
Parent: Object

Methods

butfirst   butlast  

Public Instance methods

Returns a new array rejecting the current one‘s first element.

@return [Array] a new array without the first element or nil if this

  array is empty

@example

  [1, 2, 3].butfirst #=> [2, 3]
  [].butfirst #=> nil

Returns a new array that has all the elements of the current but the last.

@return [Array] a new array without the last element or an empty array if this

  array is empty

@example

  [1, 2, 3].butlast #=> [1, 2]
  [].butlast #=> []

[Validate]