Method: LazyArray#slice!

Defined in:
lib/dm-core/support/lazy_array.rb

#slice!(*args) ⇒ Object



119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/dm-core/support/lazy_array.rb', line 119

def slice!(*args)
  index, length = extract_slice_arguments(*args)

  if index >= 0 && lazy_possible?(@head, index + length)
    @head.slice!(*args)
  elsif index < 0 && lazy_possible?(@tail, index.abs - 1 + length)
    @tail.slice!(*args)
  else
    lazy_load
    @array.slice!(*args)
  end
end