[DOC] Tweaks for Array#<<

This commit is contained in:
BurdetteLamar 2024-08-02 20:17:47 +01:00 committed by Peter Zhu
parent a793b5376c
commit 3471437630
Notes: git 2024-08-06 19:46:03 +00:00

13
array.c
View File

@ -1346,18 +1346,15 @@ ary_take_first_or_last(int argc, const VALUE *argv, VALUE ary, enum ary_take_pos
/* /*
* call-seq: * call-seq:
* array << object -> self * self << object -> self
* *
* Appends +object+ to +self+; returns +self+: * Appends +object+ as the last element in +self+; returns +self+:
* *
* a = [:foo, 'bar', 2] * [:foo, 'bar', 2] << :baz # => [:foo, "bar", 2, :baz]
* a << :baz # => [:foo, "bar", 2, :baz]
* *
* Appends +object+ as one element, even if it is another +Array+: * Appends +object+ as a single element, even if it is another array:
* *
* a = [:foo, 'bar', 2] * [:foo, 'bar', 2] << [3, 4] # => [:foo, "bar", 2, [3, 4]]
* a1 = a << [3, 4]
* a1 # => [:foo, "bar", 2, [3, 4]]
* *
*/ */