fn shift(vm: &mut VM, self_val: Value, args: &Args2) -> VMResult {
    args.check_args_range(0, 1)?;
    let mut array_flag = false;
    let num = if args.len() == 0 {
        0
    } else {
        let i = vm[0].coerce_to_fixnum("1st arg")?;
        if i < 0 {
            return Err(RubyError::argument("Negative array size."));
        }
        array_flag = true;
        i as usize
    };

    let mut ary = self_val.into_array();
    if array_flag {
        if ary.len() < num {
            return Ok(Value::array_empty().into());
        }
        let new = ArrayInfo::new_from_slice(&ary[num..]);
        let res = Value::array_from_slice(&ary[0..num]);
        *ary = new;
        Ok(res)
    } else {
        if ary.len() == 0 {
            return Ok(Value::nil());
        }
        let res = ary[0];
        *ary = ArrayInfo::new_from_slice(&ary[1..]);
        Ok(res)
    }
}
## instance method Array#shift
- shift -> object | nil
- shift(n) -> Array

https://docs.ruby-lang.org/ja/latest/method/Array/i/shift.html
ruruby/src/builtin/array.rs