PATH:
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Array
U:RDoc::AnyMethod[iI"slice!:ETI"Array#slice!;TF:publico:RDoc::Markup::Document:@parts[/o:RDoc::Markup::Paragraph; [I".Removes and returns elements from +self+.;To:RDoc::Markup::BlankLine o; ; [I"*With numeric argument +index+ given, ;TI"7removes and returns the element at offset +index+:;T@o:RDoc::Markup::Verbatim; [ I"a = ['a', 'b', 'c', 'd'] ;TI"a.slice!(2) # => "c" ;TI"(a # => ["a", "b", "d"] ;TI"a.slice!(2.1) # => "d" ;TI"#a # => ["a", "b"] ;T:@format0o; ; [I"EIf +index+ is negative, counts backwards from the end of +self+:;T@o;; [I"a = ['a', 'b', 'c', 'd'] ;TI"a.slice!(-2) # => "c" ;TI"'a # => ["a", "b", "d"] ;T; 0o; ; [I"/If +index+ is out of range, returns +nil+.;T@o; ; [I"8With numeric arguments +start+ and +length+ given, ;TI"Sremoves +length+ elements from +self+ beginning at zero-based offset +start+; ;TI"0returns the removed objects in a new array:;T@o;; [ I"a = ['a', 'b', 'c', 'd'] ;TI"(a.slice!(1, 2) # => ["b", "c"] ;TI"(a # => ["a", "d"] ;TI"#a.slice!(0.1, 1.1) # => ["a"] ;TI"#a # => ["d"] ;T; 0o; ; [I"EIf +start+ is negative, counts backwards from the end of +self+:;T@o;; [I"a = ['a', 'b', 'c', 'd'] ;TI" a.slice!(-2, 1) # => ["c"] ;TI"*a # => ["a", "b", "d"] ;T; 0o; ; [I"/If +start+ is out-of-range, returns +nil+:;T@o;; [I"a = ['a', 'b', 'c', 'd'] ;TI"a.slice!(5, 1) # => nil ;TI"a.slice!(-5, 1) # => nil ;T; 0o; ; [I"8If <tt>start + length</tt> exceeds the array size, ;TI"Eremoves and returns all elements from offset +start+ to the end:;T@o;; [I"a = ['a', 'b', 'c', 'd'] ;TI"%a.slice!(2, 50) # => ["c", "d"] ;TI"%a # => ["a", "b"] ;T; 0o; ; [I"?If <tt>start == a.size</tt> and +length+ is non-negative, ;TI"returns a new empty array.;T@o; ; [I",If +length+ is negative, returns +nil+.;T@o; ; [I"(With Range argument +range+ given, ;TI"5treats <tt>range.min</tt> as +start+ (as above) ;TI"4and <tt>range.size</tt> as +length+ (as above):;T@o;; [I"a = ['a', 'b', 'c', 'd'] ;TI"$a.slice!(1..2) # => ["b", "c"] ;TI"$a # => ["a", "d"] ;T; 0o; ; [I"BIf <tt>range.start == a.size</tt>, returns a new empty array:;T@o;; [I"a = ['a', 'b', 'c', 'd'] ;TI"a.slice!(4..5) # => [] ;T; 0o; ; [I"JIf <tt>range.start</tt> is larger than the array size, returns +nil+:;T@o;; [I"a = ['a', 'b', 'c', 'd'] ;TI"a.slice!(5..6) # => nil ;T; 0o; ; [I"*If <tt>range.start</tt> is negative, ;TI"Mcalculates the start index by counting backwards from the end of +self+:;T@o;; [I"a = ['a', 'b', 'c', 'd'] ;TI" a.slice!(-2..2) # => ["c"] ;T; 0o; ; [I"(If <tt>range.end</tt> is negative, ;TI"Kcalculates the end index by counting backwards from the end of +self+:;T@o;; [I"a = ['a', 'b', 'c', 'd'] ;TI"*a.slice!(0..-2) # => ["a", "b", "c"] ;T; 0o; ; [I"NRelated: see {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].;T: @fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"pslice!(index) -> object or nil slice!(start, length) -> new_array or nil slice!(range) -> new_array or nil ;T0[ I"(*args);T@|FI" Array;TcRDoc::NormalClass00
[+]
..
[-] assoc-i.ri
[edit]
[-] %2d-i.ri
[edit]
[-] bsearch_index-i.ri
[edit]
[-] collect-i.ri
[edit]
[-] last-i.ri
[edit]
[-] include%3f-i.ri
[edit]
[-] count-i.ri
[edit]
[-] size-i.ri
[edit]
[-] bsearch-i.ri
[edit]
[-] %7c-i.ri
[edit]
[-] all%3f-i.ri
[edit]
[-] try_convert-c.ri
[edit]
[-] %3c%3c-i.ri
[edit]
[-] to_s-i.ri
[edit]
[-] delete-i.ri
[edit]
[-] flatten%21-i.ri
[edit]
[-] max-i.ri
[edit]
[-] uniq%21-i.ri
[edit]
[-] %2a-i.ri
[edit]
[-] push-i.ri
[edit]
[-] pop-i.ri
[edit]
[-] transpose-i.ri
[edit]
[-] initialize_copy-i.ri
[edit]
[-] first-i.ri
[edit]
[-] any%3f-i.ri
[edit]
[-] %3c%3d%3e-i.ri
[edit]
[-] %5b%5d%3d-i.ri
[edit]
[-] prepend-i.ri
[edit]
[-] reverse_each-i.ri
[edit]
[-] collect%21-i.ri
[edit]
[-] each_index-i.ri
[edit]
[-] sort-i.ri
[edit]
[-] shuffle-i.ri
[edit]
[-] to_a-i.ri
[edit]
[-] union-i.ri
[edit]
[-] flatten-i.ri
[edit]
[-] %26-i.ri
[edit]
[-] filter-i.ri
[edit]
[-] shelljoin-i.ri
[edit]
[-] new-c.ri
[edit]
[-] reject%21-i.ri
[edit]
[-] reverse%21-i.ri
[edit]
[-] minmax-i.ri
[edit]
[-] difference-i.ri
[edit]
[-] sample-i.ri
[edit]
[-] fetch_values-i.ri
[edit]
[-] fill-i.ri
[edit]
[-] reverse-i.ri
[edit]
[-] find_index-i.ri
[edit]
[-] rotate-i.ri
[edit]
[-] fetch-i.ri
[edit]
[-] sum-i.ri
[edit]
[-] join-i.ri
[edit]
[-] min-i.ri
[edit]
[-] to_h-i.ri
[edit]
[-] to_ary-i.ri
[edit]
[-] take_while-i.ri
[edit]
[-] repeated_permutation-i.ri
[edit]
[-] hash-i.ri
[edit]
[-] one%3f-i.ri
[edit]
[-] values_at-i.ri
[edit]
[-] uniq-i.ri
[edit]
[-] product-i.ri
[edit]
[-] each-i.ri
[edit]
[-] permutation-i.ri
[edit]
[-] eql%3f-i.ri
[edit]
[-] intersect%3f-i.ri
[edit]
[-] slice-i.ri
[edit]
[-] append-i.ri
[edit]
[-] sort%21-i.ri
[edit]
[-] empty%3f-i.ri
[edit]
[-] slice%21-i.ri
[edit]
[-] keep_if-i.ri
[edit]
[-] map-i.ri
[edit]
[-] intersection-i.ri
[edit]
[-] repeated_combination-i.ri
[edit]
[-] sort_by%21-i.ri
[edit]
[-] combination-i.ri
[edit]
[-] insert-i.ri
[edit]
[-] map%21-i.ri
[edit]
[-] zip-i.ri
[edit]
[-] drop-i.ri
[edit]
[-] %5b%5d-i.ri
[edit]
[-] shuffle%21-i.ri
[edit]
[-] at-i.ri
[edit]
[-] reject-i.ri
[edit]
[-] shift-i.ri
[edit]
[-] filter%21-i.ri
[edit]
[-] compact-i.ri
[edit]
[-] rassoc-i.ri
[edit]
[-] freeze-i.ri
[edit]
[-] %2b-i.ri
[edit]
[-] drop_while-i.ri
[edit]
[-] take-i.ri
[edit]
[-] dig-i.ri
[edit]
[-] select-i.ri
[edit]
[-] cdesc-Array.ri
[edit]
[-] cycle-i.ri
[edit]
[-] %3d%3d-i.ri
[edit]
[-] rotate%21-i.ri
[edit]
[-] index-i.ri
[edit]
[-] rindex-i.ri
[edit]
[-] pack-i.ri
[edit]
[-] inspect-i.ri
[edit]
[-] select%21-i.ri
[edit]
[-] replace-i.ri
[edit]
[-] %5b%5d-c.ri
[edit]
[-] none%3f-i.ri
[edit]
[-] clear-i.ri
[edit]
[-] length-i.ri
[edit]
[-] concat-i.ri
[edit]
[-] unshift-i.ri
[edit]
[-] delete_at-i.ri
[edit]
[-] delete_if-i.ri
[edit]
[-] compact%21-i.ri
[edit]