Sha256: 911ffb55123eb255303c5fc9ab5c670dd8b8602e1d48320a0a08dd113a80927e
Contents?: true
Size: 514 Bytes
Versions: 2
Compression:
Stored size: 514 Bytes
Contents
# -*- encoding: utf-8 -*- # -*- frozen_string_literal: true -*- # -*- warn_indent: true -*- class Array # Alters the array by removing first +n+ elements. # # If a negative number is given, raises an +ArgumentError+. # # ==== Attributes # # * +n+ - Number of elements to take from the array. # # ==== Examples # # [].take!(3) # => [] # [1, 2, 3, 4, 5].take!(3) #=> [1, 2, 3] # [1, 2, 3, 4, 5].take!(6) #=> [1, 2, 3, 4, 5] def take!(n) replace(take(n)) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rb_core_extensions-0.1.3 | lib/core_extensions/array/delete.rb |
rb_core_extensions-0.1.2 | lib/core_extensions/array/delete.rb |