Sha256: 8e603f45faa1a1a858351f099edd25d728642ff73efeb863e28bea2bbdf16c5c

Contents?: true

Size: 162 Bytes

Versions: 2

Compression:

Stored size: 162 Bytes

Contents

# encoding: utf-8

class Array
  # Returns all elements excluding the last one
  def butlast
    if empty?
      []
    else
      self[0...-1]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
inactive_support-1.3.0 lib/inactive_support/array/butlast.rb
inactive_support-1.2.0 lib/inactive_support/array/butlast.rb