Uses modulo operator error

On the data_structures.rb file it has us write code without modulo. I wrote it a different way than the hint suggested but it throws the uses modulo error.

#EXPERT

# Write a method that is functionally equivalent to the rotate(offset) method of
# arrays. offset=1 ensures that the value of offset is 1 if no argument is
# provided. HINT: use the take(num) and drop(num) methods. You won't need much
# code, but the solution is tricky!
def my_rotate(arr, offset=1)
  # your code goes here
  i = 0;
  while (i < offset.abs) do
    if offset < 0
      popped = arr.pop
      arr.unshift(popped)
    else
      shifted = arr.shift;
      arr.push(shifted)
    end
    i += 1
  end
  return arr
end