D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Range
/
Filename :
minmax-i.ri
back
Copy
U:RDoc::AnyMethod[iI"minmax:ETI"Range#minmax;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"SReturns a 2-element array containing the minimum and maximum value in +self+, ;TI"Jeither according to comparison method <tt>#<=></tt> or a given block.;To:RDoc::Markup::BlankLine o; ; [I"BWith no block given, returns the minimum and maximum values, ;TI"(using <tt>#<=></tt> for comparison:;T@o:RDoc::Markup::Verbatim; [ I"#(1..4).minmax # => [1, 4] ;TI"#(1...4).minmax # => [1, 3] ;TI"'('a'..'d').minmax # => ["a", "d"] ;TI"%(-4..-1).minmax # => [-4, -1] ;T:@format0o; ; [I":With a block given, the block must return an integer:;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o; ; [I")Negative if +a+ is smaller than +b+.;To;;0; [o; ; [I"#Zero if +a+ and +b+ are equal.;To;;0; [o; ; [I"(Positive if +a+ is larger than +b+.;T@o; ; [I"GThe block is called <tt>self.size</tt> times to compare elements; ;TI"Vreturns a 2-element Array containing the minimum and maximum values from +self+, ;TI"per the block:;T@o;; [I"4(1..4).minmax {|a, b| -(a <=> b) } # => [4, 1] ;T; 0o; ; [I"$Returns <tt>[nil, nil]</tt> if:;T@o;;;;[o;;0; [o; ; [I"?The begin value of the range is larger than the end value:;T@o;; [I"8(4..1).minmax # => [nil, nil] ;TI"8(4..1).minmax {|a, b| -(a <=> b) } # => [nil, nil] ;T; 0o;;0; [o; ; [I"EThe begin value of an exclusive range is equal to the end value:;T@o;; [I"=(1...1).minmax # => [nil, nil] ;TI"=(1...1).minmax {|a, b| -(a <=> b) } # => [nil, nil] ;T; 0o; ; [I"FRaises an exception if +self+ is a beginless or an endless range.;T@o; ; [I"#Related: Range#min, Range#max.;T: @fileI"range.c;T:0@omit_headings_from_table_of_contents_below0I"Iminmax -> [object, object] minmax {|a, b| ... } -> [object, object] ;T0[ I"();T@SFI" Range;TcRDoc::NormalClass00