D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Array
/
Filename :
max-i.ri
back
Copy
U:RDoc::AnyMethod[iI"max:ETI"Array#max;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I""Returns one of the following:;To:RDoc::Markup::BlankLine o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o; ; [I",The maximum-valued element from +self+.;To;;0; [o; ; [I"8A new array of maximum-valued elements from +self+.;T@o; ; [I"Does not modify +self+.;T@o; ; [I"VWith no block given, each element in +self+ must respond to method <tt>#<=></tt> ;TI"with a numeric.;T@o; ; [I"BWith no argument and no block, returns the element in +self+ ;TI"7having the maximum value per method <tt>#<=></tt>:;T@o:RDoc::Markup::Verbatim; [I"[1, 0, 3, 2].max # => 3 ;T:@format0o; ; [I">With non-negative numeric argument +count+ and no block, ;TI"8returns a new array with at most +count+ elements, ;TI"3in descending order, per method <tt>#<=></tt>:;T@o;; [ I"*[1, 0, 3, 2].max(3) # => [3, 2, 1] ;TI"*[1, 0, 3, 2].max(3.0) # => [3, 2, 1] ;TI"-[1, 0, 3, 2].max(9) # => [3, 2, 1, 0] ;TI"#[1, 0, 3, 2].max(0) # => [] ;T;0o; ; [I"9With a block given, the block must return a numeric.;T@o; ; [I"eWith a block and no argument, calls the block <tt>self.size - 1</tt> times to compare elements; ;TI"@returns the element having the maximum value per the block:;T@o;; [I"<['0', '', '000', '00'].max {|a, b| a.size <=> b.size } ;TI"# => "000" ;T;0o; ; [I"=With non-negative numeric argument +count+ and a block, ;TI"8returns a new array with at most +count+ elements, ;TI"(in descending order, per the block:;T@o;; [I"?['0', '', '000', '00'].max(2) {|a, b| a.size <=> b.size } ;TI"# => ["000", "00"] ;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"omax -> element max(count) -> new_array max {|a, b| ... } -> element max(count) {|a, b| ... } -> new_array ;T0[ I"(*args);T@KFI" Array;TcRDoc::NormalClass00