class HexaPDF::PDFArray

def slice!(arg1, arg2 = nil)

them or +nil+ if the index is out of range.
Deletes the element(s) given by an index (and optionally a length) or by a range, and returns

array.slice!(range) -> new_array or nil
array.slice!(start, length) -> new_array or nil
array.slice!(index) -> obj or nil
:call-seq:
def slice!(arg1, arg2 = nil)
  data = value.slice!(arg1, *arg2)
  if arg2 || arg1.kind_of?(Range)
    data.map! {|item| process_entry(item) }
  else
    process_entry(data)
  end
end