You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: array.rs
    path of file: ./repos/ruruby/ruruby/src/builtin
    
    the code of the file until where you have to start completion: //use crate::error::RubyError;
use crate::*;
use fxhash::FxHashSet;

pub(crate) fn init(globals: &mut Globals) -> Value {
    let class = Module::class_under_object();
    globals.set_toplevel_constant("Array", class);
    class.add_builtin_method_by_str(globals, "inspect", inspect);
    class.add_builtin_method_by_str(globals, "to_s", inspe
    
    fn flatten() {
        let program = r#"
        a = [1, [2, 3, [4], 5]]
        assert [1, 2, 3, 4, 5], a.flatten
        assert [1, [2, 3, [4], 5]], a
        assert [1, [2, 3, [4], 5]], a.flatten(0)
        assert [1, 2, 3, [4], 5], a.flatten(1)
        assert [1, 2, 3, 4, 5], a.flatten(2)
        assert [1, 2, 3, 4, 5], a.flatten(3)

        a = [1]
        a << a
        assert_error { a.flatten }
        assert_error { a.flatten(-1) }
        assert_error { a.flatten("1") }
        assert [1, a], a.flatten(0)
        assert [1, 1, a], a.flatten(1)

        a = [1, [2, 3, [4], 5]]
        assert [1, 2, 3, 4, 5], a.flatten!
        assert [1, 2, 3, 4, 5], a
        assert nil, a.flatten!

        a = [1, [2, 3, [4], 5]]
        assert nil, a.flatten!(0)
        assert [1, 2, 3, [4], 5], a.flatten!(1)
        assert [1, 2, 3, 4, 5], a.flatten!(2)
        assert nil, a.flatten!(2)

        a = [1]
        a << a
        assert_error { a.flatten! }
        assert_error { a.flatten!(-1) }
        assert_error { a.flatten!("1") }
        assert [1, a], a
        assert nil, a.flatten!(0)
        assert [1, 1, 1, a], a.flatten!(2)
        "#;
        assert_script(program);
    }