[DOC] Tweaks for Array#push

This commit is contained in:
BurdetteLamar 2024-08-14 22:06:34 +01:00 committed by Peter Zhu
parent edda29a117
commit d2361ba156
Notes: git 2024-08-15 16:50:04 +00:00

16
array.c
View File

@ -1395,22 +1395,20 @@ rb_ary_cat(VALUE ary, const VALUE *argv, long len)
/*
* call-seq:
* array.push(*objects) -> self
*
* Appends trailing elements.
* push(*objects) -> self
* append(*objects) -> self
*
* Appends each argument in +objects+ to +self+; returns +self+:
*
* a = [:foo, 'bar', 2]
* a = [:foo, 'bar', 2] # => [:foo, "bar", 2]
* a.push(:baz, :bat) # => [:foo, "bar", 2, :baz, :bat]
*
* Appends each argument as one element, even if it is another +Array+:
* Appends each argument as a single element, even if it is another array:
*
* a = [:foo, 'bar', 2]
* a1 = a.push([:baz, :bat], [:bam, :bad])
* a1 # => [:foo, "bar", 2, [:baz, :bat], [:bam, :bad]]
* a = [:foo, 'bar', 2] # => [:foo, "bar", 2]
a.push([:baz, :bat], [:bam, :bad]) # => [:foo, "bar", 2, [:baz, :bat], [:bam, :bad]]
*
* Related: #pop, #shift, #unshift.
* Related: Array#pop, Array#shift, Array#unshift.
*/
static VALUE