ÿØÿà JFIF ÿÛ „ ( %!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
ÿØÿà JFIF ÿÛ „
(
%!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ
ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ
ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ
? ¼QxJQaÍuò¸Zö
Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
????????????????????????????????????
????????????????????????????????????
ÿØÿà JFIF ÿÛ „ ( %!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
ÿØÿà JFIF ÿÛ „
(
%!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ
ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ
ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ
? ¼QxJQaÍuò¸Zö
Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
????????????????????????????????????
????????????????????????????????????
U:RDoc::NormalModule[iI"Enumerable:ET@0o:RDoc::Markup::Document:@parts[o;;[GS:RDoc::Markup::Heading:
leveli: textI"What's Here;To:RDoc::Markup::BlankLine o:RDoc::Markup::Paragraph;[I"T\Module \Enumerable provides methods that are useful to a collection class for:;T@o:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o;
;[I"9{Querying}[rdoc-ref:Enumerable@Methods+for+Querying];To;;0;[o;
;[I"9{Fetching}[rdoc-ref:Enumerable@Methods+for+Fetching];To;;0;[o;
;[I"W{Searching and Filtering}[rdoc-ref:Enumerable@Methods+for+Searching+and+Filtering];To;;0;[o;
;[I"7{Sorting}[rdoc-ref:Enumerable@Methods+for+Sorting];To;;0;[o;
;[I";{Iterating}[rdoc-ref:Enumerable@Methods+for+Iterating];To;;0;[o;
;[I"6{And more....}[rdoc-ref:Enumerable@Other+Methods];T@S; ;
i;I"Methods for Querying;T@o;
;[I"_These methods return information about the \Enumerable other than the elements themselves:;T@o;;;;[o;;0;[o;
;[I"c#member? (aliased as #include?): Returns +true+ if self == object, +false+ otherwise.;To;;0;[o;
;[I"Y#all?: Returns +true+ if all elements meet a specified criterion; +false+ otherwise.;To;;0;[o;
;[I"Y#any?: Returns +true+ if any element meets a specified criterion; +false+ otherwise.;To;;0;[o;
;[I"Y#none?: Returns +true+ if no element meets a specified criterion; +false+ otherwise.;To;;0;[o;
;[I"a#one?: Returns +true+ if exactly one element meets a specified criterion; +false+ otherwise.;To;;0;[o;
;[I",#count: Returns the count of elements, ;TI"7based on an argument or block criterion, if given.;To;;0;[o;
;[I"U#tally: Returns a new Hash containing the counts of occurrences of each element.;T@S; ;
i;I"Methods for Fetching;T@o;
;[I"MThese methods return entries from the \Enumerable, without modifying it:;T@o;
;[I"/Leading, trailing, or all elements:;T@o;;;;[o;;0;[o;
;[I"7#to_a (aliased as #entries): Returns all elements.;To;;0;[o;
;[I";#first: Returns the first element or leading elements.;To;;0;[o;
;[I";#take: Returns a specified number of leading elements.;To;;0;[o;
;[I"<#drop: Returns a specified number of trailing elements.;To;;0;[o;
;[I"K#take_while: Returns leading elements as specified by the given block.;To;;0;[o;
;[I"L#drop_while: Returns trailing elements as specified by the given block.;T@o;
;[I"/Minimum and maximum value elements:;T@o;;;;[o;;0;[o;
;[I"N#min: Returns the elements whose values are smallest among the elements, ;TI"5as determined by #<=> or a given block.;To;;0;[o;
;[I"M#max: Returns the elements whose values are largest among the elements, ;TI"5as determined by #<=> or a given block.;To;;0;[o;
;[I"U#minmax: Returns a 2-element Array containing the smallest and largest elements.;To;;0;[o;
;[I"M#min_by: Returns the smallest element, as determined by the given block.;To;;0;[o;
;[I"L#max_by: Returns the largest element, as determined by the given block.;To;;0;[o;
;[I"]#minmax_by: Returns the smallest and largest elements, as determined by the given block.;T@o;
;[I"+Groups, slices, and partitions:;T@o;;;;[o;;0;[o;
;[I"H#group_by: Returns a Hash that partitions the elements into groups.;To;;0;[o;
;[I"d#partition: Returns elements partitioned into two new Arrays, as determined by the given block.;To;;0;[o;
;[I"U#slice_after: Returns a new Enumerator whose entries are a partition of +self+, ;TI"7based either on a given +object+ or a given block.;To;;0;[o;
;[I"V#slice_before: Returns a new Enumerator whose entries are a partition of +self+, ;TI"7based either on a given +object+ or a given block.;To;;0;[o;
;[I"S#slice_when: Returns a new Enumerator whose entries are a partition of +self+ ;TI"based on the given block.;To;;0;[o;
;[I"T#chunk: Returns elements organized into chunks as specified by the given block.;To;;0;[o;
;[I"Z#chunk_while: Returns elements organized into chunks as specified by the given block.;T@S; ;
i;I"(Methods for Searching and Filtering;T@o;
;[I"CThese methods return elements that meet a specified criterion:;T@o;;;;[
o;;0;[o;
;[I"J#find (aliased as #detect): Returns an element selected by the block.;To;;0;[o;
;[I"U#find_all (aliased as #filter, #select): Returns elements selected by the block.;To;;0;[o;
;[I"V#find_index: Returns the index of an element selected by a given object or block.;To;;0;[o;
;[I"9#reject: Returns elements not rejected by the block.;To;;0;[o;
;[I"5#uniq: Returns elements that are not duplicates.;T@S; ;
i;I"Methods for Sorting;T@o;
;[I"3These methods return elements in sorted order:;T@o;;;;[o;;0;[o;
;[I"M#sort: Returns the elements, sorted by #<=> or the given block.;To;;0;[o;
;[I"?#sort_by: Returns the elements, sorted by the given block.;T@S; ;
i;I"Methods for Iterating;T@o;;;;[o;;0;[o;
;[I"?#each_entry: Calls the block with each successive element ;TI"%(slightly different from #each).;To;;0;[o;
;[I"R#each_with_index: Calls the block with each successive element and its index.;To;;0;[o;
;[I"X#each_with_object: Calls the block with each successive element and a given object.;To;;0;[o;
;[I"I#each_slice: Calls the block with successive non-overlapping slices.;To;;0;[o;
;[I"E#each_cons: Calls the block with successive overlapping slices. ;TI""(different from #each_slice).;To;;0;[o;
;[I"S#reverse_each: Calls the block with each successive element, in reverse order.;T@S; ;
i;I"Other Methods;T@o;;;;[o;;0;[o;
;[I"G#collect (aliased as #map): Returns objects returned by the block.;To;;0;[o;
;[I"?#filter_map: Returns truthy objects returned by the block.;To;;0;[o;
;[I"]#flat_map (aliased as #collect_concat): Returns flattened objects returned by the block.;To;;0;[o;
;[I"8#grep: Returns elements selected by a given object ;TI"*or objects returned by a given block.;To;;0;[o;
;[I":#grep_v: Returns elements selected by a given object ;TI"*or objects returned by a given block.;To;;0;[o;
;[I"W#inject (aliased as #reduce): Returns the object formed by combining all elements.;To;;0;[o;
;[I"D#sum: Returns the sum of the elements, using method +.;To;;0;[o;
;[I"G#zip: Combines each element with elements from other enumerables; ;TI"7returns the n-tuples or calls the block with each.;To;;0;[o;
;[I"C#cycle: Calls the block with each element, cycling repeatedly.;T@S; ;
i;I"
Usage;T@o;
;[I"5To use module \Enumerable in a collection class:;T@o;;;;[o;;0;[o;
;[I"Include it:;T@o:RDoc::Markup::Verbatim;[I"include Enumerable
;T:@format0o;;0;[o;
;[I"%Implement method #each ;TI"=which must yield successive elements of the collection. ;TI"@The method will be called by almost any \Enumerable method.;T@o;
;[I"
Example:;T@o;;[I"class Foo
;TI" include Enumerable
;TI" def each
;TI" yield 1
;TI" yield 1, 2
;TI" yield
;TI" end
;TI" end
;TI"/Foo.new.each_entry{ |element| p element }
;T;0o;
;[I"Output:;T@o;;[I"1
;TI"[1, 2]
;TI" nil
;T;0S; ;
i;I" \Enumerable in Ruby Classes;T@o;
;[I"=These Ruby core classes include (or extend) \Enumerable:;T@o;;;;[o;;0;[o;
;[I" ARGF;To;;0;[o;
;[I"
Array;To;;0;[o;
;[I"Dir;To;;0;[o;
;[I"Enumerator;To;;0;[o;
;[I"ENV (extends);To;;0;[o;
;[I" Hash;To;;0;[o;
;[I"IO;To;;0;[o;
;[I"
Range;To;;0;[o;
;[I"Struct;T@o;
;[I"=These Ruby standard library classes include \Enumerable:;T@o;;;;[ o;;0;[o;
;[I"CSV;To;;0;[o;
;[I"CSV::Table;To;;0;[o;
;[I"
CSV::Row;To;;0;[o;
;[I"Set;T@o;
;[I"UVirtually all methods in \Enumerable call method +#each+ in the including class:;T@o;;;;[o;;0;[o;
;[I"LHash#each yields the next key-value pair as a 2-element Array.;To;;0;[o;
;[I"OStruct#each yields the next name-value pair as a 2-element Array.;To;;0;[o;
;[I"UFor the other classes above, +#each+ yields the next object from the collection.;T@S; ;
i;I"About the Examples;T@o;
;[I";The example code snippets for the \Enumerable methods:;T@o;;;;[o;;0;[o;
;[I"PAlways show the use of one or more Array-like classes (often Array itself).;To;;0;[o;
;[I"2Sometimes show the use of a Hash-like class. ;TI"?For some methods, though, the usage would not make sense, ;TI"Xand so it is not shown. Example: #tally would find exactly one of each Hash entry.;T:
@fileI"enum.c;T:0@omit_headings_from_table_of_contents_below0o;;[ ;I"lib/set.rb;T;0o;;[ ;I"prelude.rb;T;0;0;0[ [ [ [[I"
class;T[[:public[ [:protected[ [:private[ [I"
instance;T[[;[B[I" all?;TI"enum.c;T[I" any?;T@[I"
chain;TI"enumerator.c;T[I"
chunk;T@[I"chunk_while;T@[I"collect;T@[I"collect_concat;T@[I"compact;T@[I"
count;T@[I"
cycle;T@[I"detect;T@[I" drop;T@[I"drop_while;T@[I"each_cons;T@[I"each_entry;T@[I"each_slice;T@[I"each_with_index;T@[I"each_with_object;T@[I"entries;T@[I"filter;T@[I"filter_map;T@[I" find;T@[I"
find_all;T@[I"find_index;T@[I"
first;T@[I"
flat_map;T@[I" grep;T@[I"grep_v;T@[I"
group_by;T@[I"
include?;T@[I"inject;T@[I" lazy;T@[I"map;T@[I"max;T@[I"max_by;T@[I"member?;T@[I"min;T@[I"min_by;T@[I"minmax;T@[I"minmax_by;T@[I"
none?;T@[I" one?;T@[I"partition;T@[I"reduce;T@[I"reject;T@[I"reverse_each;T@[I"select;T@[I"slice_after;T@[I"slice_before;T@[I"slice_when;T@[I" sort;T@[I"sort_by;T@[I"sum;T@[I" take;T@[I"take_while;T@[I"
tally;T@[I" to_a;T@[I" to_h;T@[I"to_set;TI"lib/set.rb;T[I" uniq;T@[I"zip;T@[;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ;0;0[ @I"enumerator.c;T@@@cRDoc::TopLevel