зеркало из https://github.com/github/ruby.git
[DOC] Tweaks for Array#push
This commit is contained in:
Родитель
edda29a117
Коммит
d2361ba156
20
array.c
20
array.c
|
@ -1395,22 +1395,20 @@ rb_ary_cat(VALUE ary, const VALUE *argv, long len)
|
|||
|
||||
/*
|
||||
* call-seq:
|
||||
* array.push(*objects) -> self
|
||||
* push(*objects) -> self
|
||||
* append(*objects) -> self
|
||||
*
|
||||
* Appends trailing elements.
|
||||
* Appends each argument in +objects+ to +self+; returns +self+:
|
||||
*
|
||||
* Appends each argument in +objects+ to +self+; returns +self+:
|
||||
* a = [:foo, 'bar', 2] # => [:foo, "bar", 2]
|
||||
* a.push(:baz, :bat) # => [:foo, "bar", 2, :baz, :bat]
|
||||
*
|
||||
* a = [:foo, 'bar', 2]
|
||||
* a.push(:baz, :bat) # => [:foo, "bar", 2, :baz, :bat]
|
||||
* Appends each argument as a single element, even if it is another array:
|
||||
*
|
||||
* Appends each argument as one element, even if it is another +Array+:
|
||||
* a = [:foo, 'bar', 2] # => [:foo, "bar", 2]
|
||||
a.push([:baz, :bat], [:bam, :bad]) # => [:foo, "bar", 2, [:baz, :bat], [:bam, :bad]]
|
||||
*
|
||||
* a = [:foo, 'bar', 2]
|
||||
* a1 = a.push([:baz, :bat], [:bam, :bad])
|
||||
* a1 # => [:foo, "bar", 2, [:baz, :bat], [:bam, :bad]]
|
||||
*
|
||||
* Related: #pop, #shift, #unshift.
|
||||
* Related: Array#pop, Array#shift, Array#unshift.
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
|
|
Загрузка…
Ссылка в новой задаче