Method: Array#insert
- Defined in:
- array.c
#insert(index, obj...) ⇒ Array
Inserts the given values before the element with the given index (which may be negative).
a = %w{ a b c d }
a.insert(2, 99) #=> ["a", "b", 99, "c", "d"]
a.insert(-2, 1, 2, 3) #=> ["a", "b", 99, "c", 1, 2, 3, "d"]
1093 1094 1095 |
# File 'array.c', line 1093 static VALUE rb_ary_insert(argc, argv, ary) int argc; |