Sha256: ad67331cf77cabdf8e4f03ba63e292d9da7baf20971398d382842f504dd31df4

Contents?: true

Size: 415 Bytes

Versions: 26

Compression:

Stored size: 415 Bytes

Contents

unless ([1].shift(1) rescue false)
  class Array
    require 'backports/tools'

    def shift_with_optional_argument(n = Backports::Undefined)
      return shift_without_optional_argument if n == Backports::Undefined
      n = Backports.coerce_to_int(n)
      raise ArgumentError, "negative array size" if n < 0
      slice!(0, n)
    end
    Backports.alias_method_chain self, :shift, :optional_argument
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
scout_realtime-1.0.5 lib/vendor/backports-3.3.5/lib/backports/1.8.7/array/shift.rb
scout_realtime-1.0.4 lib/vendor/backports-3.3.5/lib/backports/1.8.7/array/shift.rb
scout_realtime-1.0.3 lib/vendor/backports-3.3.5/lib/backports/1.8.7/array/shift.rb
scout_realtime-1.0.3.pre lib/vendor/backports-3.3.5/lib/backports/1.8.7/array/shift.rb
scout_realtime-1.0.2 lib/vendor/backports-3.3.5/lib/backports/1.8.7/array/shift.rb
scout_realtime-1.0.1 lib/vendor/backports-3.3.5/lib/backports/1.8.7/array/shift.rb
scout_realtime-1.0.0 lib/vendor/backports-3.3.5/lib/backports/1.8.7/array/shift.rb
scout_realtime-0.5.5 lib/vendor/backports-3.3.5/lib/backports/1.8.7/array/shift.rb
scout_realtime-0.5.5.pre lib/vendor/backports-3.3.5/lib/backports/1.8.7/array/shift.rb
scout_realtime-0.5.4 lib/vendor/backports-3.3.5/lib/backports/1.8.7/array/shift.rb
backports-3.6.0 lib/backports/1.8.7/array/shift.rb
backports-3.5.0 lib/backports/1.8.7/array/shift.rb
backports-3.4.1 lib/backports/1.8.7/array/shift.rb
scout_realtime-0.5.3 lib/vendor/backports-3.3.5/lib/backports/1.8.7/array/shift.rb
scout_realtime-0.5.2 lib/vendor/backports-3.3.5/lib/backports/1.8.7/array/shift.rb
scout_realtime-0.5.1 lib/vendor/backports-3.3.5/lib/backports/1.8.7/array/shift.rb
backports-3.4.0 lib/backports/1.8.7/array/shift.rb
backports-3.3.5 lib/backports/1.8.7/array/shift.rb
backports-3.3.4 lib/backports/1.8.7/array/shift.rb
backports-3.3.3 lib/backports/1.8.7/array/shift.rb