ÿØÿà JFIF ÿÛ „ ( %!1!%*+...983,7(-.-
%3c%3d-i.ri 0000644 00000000670 15240056003 0006172 0 ustar 00 U:RDoc::AnyMethod[iI"<=:ETI"Comparable#<=;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"CCompares two objects based on the receiver's <=> ;TI"Jmethod, returning true if it returns a value less than or equal to 0.;T:
@fileI"
compar.c;T:0@omit_headings_from_table_of_contents_below0I"&obj <= other -> true or false
;T0[ I" (p1);T@FI"Comparable;TcRDoc::NormalModule00 %3e%3d-i.ri 0000644 00000000673 15240056003 0006177 0 ustar 00 U:RDoc::AnyMethod[iI">=:ETI"Comparable#>=;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"CCompares two objects based on the receiver's <=> ;TI"Mmethod, returning true if it returns a value greater than or equal to 0.;T:
@fileI"
compar.c;T:0@omit_headings_from_table_of_contents_below0I"&obj >= other -> true or false
;T0[ I" (p1);T@FI"Comparable;TcRDoc::NormalModule00 %3e-i.ri 0000644 00000000654 15240056003 0005702 0 ustar 00 U:RDoc::AnyMethod[iI">:ETI"Comparable#>;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"CCompares two objects based on the receiver's <=> ;TI"Amethod, returning true if it returns a value greater than 0.;T:
@fileI"
compar.c;T:0@omit_headings_from_table_of_contents_below0I"%obj > other -> true or false
;T0[ I" (p1);T@FI"Comparable;TcRDoc::NormalModule00 between%3f-i.ri 0000644 00000001370 15240056003 0007251 0 ustar 00 U:RDoc::AnyMethod[iI"
between?:ETI"Comparable#between?;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"HReturns false if _obj_ <=> _min_ is less ;TI"Hthan zero or if _obj_ <=> _max_ is greater than zero, ;TI"!true otherwise.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [ I"-3.between?(1, 5) #=> true
;TI".6.between?(1, 5) #=> false
;TI"-'cat'.between?('ant', 'dog') #=> true
;TI"-'gnu'.between?('ant', 'dog') #=> false;T:@format0:
@fileI"
compar.c;T:0@omit_headings_from_table_of_contents_below0I"0obj.between?(min, max) -> true or false
;T0[ I"
(p1, p2);T@FI"Comparable;TcRDoc::NormalModule00 %3c-i.ri 0000644 00000000651 15240056003 0005675 0 ustar 00 U:RDoc::AnyMethod[iI"<:ETI"Comparable#<;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"CCompares two objects based on the receiver's <=> ;TI">method, returning true if it returns a value less than 0.;T:
@fileI"
compar.c;T:0@omit_headings_from_table_of_contents_below0I"%obj < other -> true or false
;T0[ I" (p1);T@FI"Comparable;TcRDoc::NormalModule00 clamp-i.ri 0000644 00000003202 15240056003 0006412 0 ustar 00 U:RDoc::AnyMethod[iI"
clamp:ETI"Comparable#clamp;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [ I"=In (min, max) form, returns _min_ if _obj_ ;TI"><=> _min_ is less than zero, _max_ if _obj_ ;TI"<<=> _max_ is greater than zero, and _obj_ ;TI"otherwise.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"%12.clamp(0, 100) #=> 12
;TI"&523.clamp(0, 100) #=> 100
;TI"$-3.123.clamp(0, 100) #=> 0
;TI"
;TI"&'d'.clamp('a', 'f') #=> 'd'
;TI"&'z'.clamp('a', 'f') #=> 'f'
;T:@format0o;
; [ I"BIn (range) form, returns _range.begin_ if _obj_ ;TI"C<=> _range.begin_ is less than zero, _range.end_ ;TI"Eif _obj_ <=> _range.end_ is greater than zero, and ;TI"_obj_ otherwise.;T@o;; [I"%12.clamp(0..100) #=> 12
;TI"&523.clamp(0..100) #=> 100
;TI"$-3.123.clamp(0..100) #=> 0
;TI"
;TI"&'d'.clamp('a'..'f') #=> 'd'
;TI"&'z'.clamp('a'..'f') #=> 'f'
;T;
0o;
; [I"EIf _range.begin_ is +nil+, it is considered smaller than _obj_, ;TI"@and if _range.end_ is +nil+, it is considered greater than ;TI"_obj_.;T@o;; [I"$-20.clamp(0..) #=> 0
;TI"&523.clamp(..100) #=> 100
;T;
0o;
; [I"AWhen _range.end_ is excluded and not +nil+, an exception is ;TI"raised.;T@o;; [I"-100.clamp(0...100) # ArgumentError;T;
0:
@fileI"
compar.c;T:0@omit_headings_from_table_of_contents_below0I"=obj.clamp(min, max) -> obj
obj.clamp(range) -> obj
;T0[ I"(p1, p2 = v2);T@8FI"Comparable;TcRDoc::NormalModule00 cdesc-Comparable.ri 0000644 00000006342 15240056003 0010224 0 ustar 00 U:RDoc::NormalModule[iI"Comparable:ET@0o:RDoc::Markup::Document:@parts[o;;[
o:RDoc::Markup::Paragraph;[I"BThe Comparable mixin is used by classes whose objects may be ;TI"Cordered. The class must define the <=> operator, ;TI"Ewhich compares the receiver against another object, returning a ;TI"Jvalue less than 0, returning 0, or returning a value greater than 0, ;TI"?depending on whether the receiver is less than, equal to, ;TI"Bor greater than the other object. If the other object is not ;TI"Hcomparable then the <=> operator should return +nil+. ;TI"DComparable uses <=> to implement the conventional ;TI"<, <=, ;TI"C==, >=, and >) and the ;TI""method between?.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim;[I"class SizeMatters
;TI" include Comparable
;TI" attr :str
;TI" def <=>(other)
;TI"% str.size <=> other.str.size
;TI" end
;TI" def initialize(str)
;TI" @str = str
;TI" end
;TI" def inspect
;TI" @str
;TI" end
;TI" end
;TI"
;TI"s1 = SizeMatters.new("Z")
;TI" s2 = SizeMatters.new("YY")
;TI"!s3 = SizeMatters.new("XXX")
;TI""s4 = SizeMatters.new("WWWW")
;TI"#s5 = SizeMatters.new("VVVVV")
;TI"
;TI",s1 < s2 #=> true
;TI"-s4.between?(s1, s3) #=> false
;TI",s4.between?(s3, s5) #=> true
;TI"A[ s3, s2, s5, s4, s1 ].sort #=> [Z, YY, XXX, WWWW, VVVVV]
;T:@format0S:RDoc::Markup::Heading:
leveli: textI"What's Here;T@o; ;[I"V\Module \Comparable provides these methods, all of which use method <=>:;T@o:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o;;: NOTE;[o;;[I"{<}[#method-i-3C];T;[o; ;[I":Returns whether +self+ is less than the given object.;To;;0;[o;;;;[o;;[I"{<=}[#method-i-3C-3D];T;[o; ;[I"5Returns whether +self+ is less than or equal to ;TI"the given object.;To;;0;[o;;;;[o;;[I"{==}[#method-i-3D-3D];T;[o; ;[I"9Returns whether +self+ is equal to the given object.;To;;0;[o;;;;[o;;[I"{>}[#method-i-3E];T;[o; ;[I"8Returns whether +self+ is greater than or equal to ;TI"the given object.;To;;0;[o;;;;[o;;[I"{>=}[#method-i-3E-3D];T;[o; ;[I"=Returns whether +self+ is greater than the given object.;To;;0;[o; ;[I"E#between? Returns +true+ if +self+ is between two given objects.;To;;0;[o;;;;[o;;[I"#clamp;T;[o; ;[I"NFor given objects +min+ and +max+, or range (min..max), returns:;To;;;;[o;;0;[o; ;[I"*+min+ if (self <=> min) < 0.;To;;0;[o; ;[I"*+max+ if (self <=> max) > 0.;To;;0;[o; ;[I"+self+ otherwise.;T:
@fileI"
compar.c;T:0@omit_headings_from_table_of_contents_below0;0;0[ [ [ [[I"
class;T[[:public[ [:protected[ [:private[ [I"
instance;T[[;[ [;[ [;[[I"<;TI"
compar.c;T[I"<=;T@[I"==;T@[I">;T@[I">=;T@[I"
between?;T@[I"
clamp;T@[ [U:RDoc::Context::Section[i 0o;;[ ;0;0[I"
compar.c;T@cRDoc::TopLevel %3d%3d-i.ri 0000644 00000000735 15240056003 0006175 0 ustar 00 U:RDoc::AnyMethod[iI"==:ETI"Comparable#==;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"CCompares two objects based on the receiver's <=> ;TI"Bmethod, returning true if it returns 0. Also returns true if ;TI"+_obj_ and _other_ are the same object.;T:
@fileI"
compar.c;T:0@omit_headings_from_table_of_contents_below0I"&obj == other -> true or false
;T0[ I" (p1);T@FI"Comparable;TcRDoc::NormalModule00