Method: HexaPDF::PDFArray#slice!

Defined in:
lib/hexapdf/pdf_array.rb

#slice!(arg1, arg2 = nil) ⇒ Object

:call-seq:

array.slice!(index)             -> obj or nil
array.slice!(start, length)     -> new_array or nil
array.slice!(range)             -> new_array or nil

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



133
134
135
136
137
138
139
140
# File 'lib/hexapdf/pdf_array.rb', line 133

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