D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Array
/
Filename :
rotate-i.ri
back
Copy
U:RDoc::AnyMethod[iI"rotate:ETI"Array#rotate;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I":Returns a new array formed from +self+ with elements ;TI"'rotated from one end to the other.;To:RDoc::Markup::BlankLine o; ; [I"(With non-negative numeric +count+, ;TI"4rotates elements from the beginning to the end:;T@o:RDoc::Markup::Verbatim; [I"0[0, 1, 2, 3].rotate(2) # => [2, 3, 0, 1] ;TI"0[0, 1, 2, 3].rotate(2.1) # => [2, 3, 0, 1] ;T:@format0o; ; [I"HIf +count+ is large, uses <tt>count % array.size</tt> as the count:;T@o;; [I"/[0, 1, 2, 3].rotate(22) # => [2, 3, 0, 1] ;T; 0o; ; [I"1With a +count+ of zero, rotates no elements:;T@o;; [I".[0, 1, 2, 3].rotate(0) # => [0, 1, 2, 3] ;T; 0o; ; [I"GWith negative numeric +count+, rotates in the opposite direction, ;TI"#from the end to the beginning:;T@o;; [I"/[0, 1, 2, 3].rotate(-1) # => [3, 0, 1, 2] ;T; 0o; ; [I"XIf +count+ is small (far from zero), uses <tt>count % array.size</tt> as the count:;T@o;; [I"0[0, 1, 2, 3].rotate(-21) # => [3, 0, 1, 2] ;T; 0o; ; [I"NRelated: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].;T: @fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"$rotate(count = 1) -> new_array ;T0[ I"(*args);T@4FI" Array;TcRDoc::NormalClass00