ÿØÿà JFIF ÿÛ „ ( %!1!%*+...983,7(-.-
PK ]CY Y length-i.rinu [ U:RDoc::AnyMethod[iI"length:ETI"Array#length;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"-Returns the count of elements in +self+.;T:
@fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I" array.length -> an_integer
;T0[[I" size;T@ I"();T@FI"
Array;TcRDoc::NormalClass00PK ]T,| | zip-i.rinu [ U:RDoc::AnyMethod[iI"zip:ETI"Array#zip;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"VWhen no block given, returns a new \Array +new_array+ of size self.size ;TI"whose elements are Arrays.;To:RDoc::Markup::BlankLine o;
; [I"VEach nested array new_array[n] is of size other_arrays.size+1, ;TI"and contains:;To:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o;
; [I"!The _nth_ element of +self+.;To;;0; [o;
; [I"5The _nth_ element of each of the +other_arrays+.;T@o;
; [I"8If all +other_arrays+ and +self+ are the same size:;To:RDoc::Markup::Verbatim; [
I"a = [:a0, :a1, :a2, :a3]
;TI"b = [:b0, :b1, :b2, :b3]
;TI"c = [:c0, :c1, :c2, :c3]
;TI"d = a.zip(b, c)
;TI"Qd # => [[:a0, :b0, :c0], [:a1, :b1, :c1], [:a2, :b2, :c2], [:a3, :b3, :c3]]
;T:@format0o;
; [I"self.size with +nil+:;To;; [
I"a = [:a0, :a1, :a2, :a3]
;TI"b = [:b0, :b1, :b2]
;TI"c = [:c0, :c1]
;TI"d = a.zip(b, c)
;TI"Qd # => [[:a0, :b0, :c0], [:a1, :b1, :c1], [:a2, :b2, nil], [:a3, nil, nil]]
;T;0o;
; [I";If any array in +other_arrays+ is larger than +self+, ;TI"'its trailing elements are ignored:;To;; [
I"a = [:a0, :a1, :a2, :a3]
;TI"#b = [:b0, :b1, :b2, :b3, :b4]
;TI"(c = [:c0, :c1, :c2, :c3, :c4, :c5]
;TI"d = a.zip(b, c)
;TI"Qd # => [[:a0, :b0, :c0], [:a1, :b1, :c1], [:a2, :b2, :c2], [:a3, :b3, :c3]]
;T;0o;
; [I"fWhen a block is given, calls the block with each of the sub-arrays (formed as above); returns nil;To;; [ I"a = [:a0, :a1, :a2, :a3]
;TI"b = [:b0, :b1, :b2, :b3]
;TI"c = [:c0, :c1, :c2, :c3]
;TI"4a.zip(b, c) {|sub_array| p sub_array} # => nil
;T;0o;
; [I"Output:;To;; [ I"[:a0, :b0, :c0]
;TI"[:a1, :b1, :c1]
;TI"[:a2, :b2, :c2]
;TI"[:a3, :b3, :c3];T;0:
@fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"`array.zip(*other_arrays) -> new_array
array.zip(*other_arrays) {|other_array| ... } -> nil
;T0[ I"(*args);T@RFI"
Array;TcRDoc::NormalClass00PK ] fill-i.rinu [ U:RDoc::AnyMethod[iI" fill:ETI"Array#fill;TF:privateo:RDoc::Markup::Document:@parts[Go:RDoc::Markup::Paragraph; [I"RReplaces specified elements in +self+ with specified objects; returns +self+.;To:RDoc::Markup::BlankLine o;
; [I"XWith argument +obj+ and no block given, replaces all elements with that one object:;To:RDoc::Markup::Verbatim; [I"a = ['a', 'b', 'c', 'd']
;TI"!a # => ["a", "b", "c", "d"]
;TI"&a.fill(:X) # => [:X, :X, :X, :X]
;T:@format0o;
; [I"DWith arguments +obj+ and \Integer +start+, and no block given, ;TI"0replaces elements based on the given start.;T@o;
; [I"@If +start+ is in range (0 <= start < array.size), ;TI"?replaces all elements from offset +start+ through the end:;To;; [I"a = ['a', 'b', 'c', 'd']
;TI"+a.fill(:X, 2) # => ["a", "b", :X, :X]
;T;
0o;
; [I"JIf +start+ is too large (start >= array.size), does nothing:;To;; [ I"a = ['a', 'b', 'c', 'd']
;TI"-a.fill(:X, 4) # => ["a", "b", "c", "d"]
;TI"a = ['a', 'b', 'c', 'd']
;TI"-a.fill(:X, 5) # => ["a", "b", "c", "d"]
;T;
0o;
; [I"aIf +start+ is negative, counts from the end (starting index is start + array.size):;To;; [I"a = ['a', 'b', 'c', 'd']
;TI",a.fill(:X, -2) # => ["a", "b", :X, :X]
;T;
0o;
; [I"RIf +start+ is too small (less than and far from zero), replaces all elements:;To;; [ I"a = ['a', 'b', 'c', 'd']
;TI"*a.fill(:X, -6) # => [:X, :X, :X, :X]
;TI"a = ['a', 'b', 'c', 'd']
;TI"+a.fill(:X, -50) # => [:X, :X, :X, :X]
;T;
0o;
; [I"XWith arguments +obj+, \Integer +start+, and \Integer +length+, and no block given, ;TI"?replaces elements based on the given +start+ and +length+.;T@o;
; [I"TIf +start+ is in range, replaces +length+ elements beginning at offset +start+:;To;; [I"a = ['a', 'b', 'c', 'd']
;TI"/a.fill(:X, 1, 1) # => ["a", :X, "c", "d"]
;T;
0o;
; [I"1If +start+ is negative, counts from the end:;To;; [I"a = ['a', 'b', 'c', 'd']
;TI"0a.fill(:X, -2, 1) # => ["a", "b", :X, "d"]
;T;
0o;
; [I"SIf +start+ is large (start >= array.size), extends +self+ with +nil+:;To;; [ I"a = ['a', 'b', 'c', 'd']
;TI"5a.fill(:X, 5, 0) # => ["a", "b", "c", "d", nil]
;TI"a = ['a', 'b', 'c', 'd']
;TI"=a.fill(:X, 5, 2) # => ["a", "b", "c", "d", nil, :X, :X]
;T;
0o;
; [I";If +length+ is zero or negative, replaces no elements:;To;; [I"a = ['a', 'b', 'c', 'd']
;TI"0a.fill(:X, 1, 0) # => ["a", "b", "c", "d"]
;TI"1a.fill(:X, 1, -1) # => ["a", "b", "c", "d"]
;T;
0o;
; [I"BWith arguments +obj+ and \Range +range+, and no block given, ;TI"0replaces elements based on the given range.;T@o;
; [I"UIf the range is positive and ascending (0 < range.begin <= range.end), ;TI"Greplaces elements from range.begin to range.end:;To;; [I"a = ['a', 'b', 'c', 'd']
;TI"1a.fill(:X, (1..1)) # => ["a", :X, "c", "d"]
;T;
0o;
; [I"?If range.first is negative, replaces no elements:;To;; [I"a = ['a', 'b', 'c', 'd']
;TI"3a.fill(:X, (-1..1)) # => ["a", "b", "c", "d"]
;T;
0o;
; [I"=If range.last is negative, counts from the end:;To;; [ I"a = ['a', 'b', 'c', 'd']
;TI"0a.fill(:X, (0..-2)) # => [:X, :X, :X, "d"]
;TI"a = ['a', 'b', 'c', 'd']
;TI"1a.fill(:X, (1..-2)) # => ["a", :X, :X, "d"]
;T;
0o;
; [I"GIf range.last and range.last are both negative, ;TI"*both count from the end of the array:;To;; [ I"a = ['a', 'b', 'c', 'd']
;TI"3a.fill(:X, (-1..-1)) # => ["a", "b", "c", :X]
;TI"a = ['a', 'b', 'c', 'd']
;TI"3a.fill(:X, (-2..-2)) # => ["a", "b", :X, "d"]
;T;
0o;
; [I"KWith no arguments and a block given, calls the block with each index; ;TI"Freplaces the corresponding element with the block's return value:;To;; [I"a = ['a', 'b', 'c', 'd']
;TI"Qa.fill { |index| "new_#{index}" } # => ["new_0", "new_1", "new_2", "new_3"]
;T;
0o;
; [I"NWith argument +start+ and a block given, calls the block with each index ;TI"Hfrom offset +start+ to the end; replaces the corresponding element ;TI"#with the block's return value:;T@o;
; [I">If start is in range (0 <= start < array.size), ;TI"-replaces from offset +start+ to the end:;To;; [I"a = ['a', 'b', 'c', 'd']
;TI"Pa.fill(1) { |index| "new_#{index}" } # => ["a", "new_1", "new_2", "new_3"]
;T;
0o;
; [I"IIf +start+ is too large(start >= array.size), does nothing:;To;; [ I"a = ['a', 'b', 'c', 'd']
;TI"Ja.fill(4) { |index| fail 'Cannot happen' } # => ["a", "b", "c", "d"]
;TI"a = ['a', 'b', 'c', 'd']
;TI"Ja.fill(4) { |index| fail 'Cannot happen' } # => ["a", "b", "c", "d"]
;T;
0o;
; [I"1If +start+ is negative, counts from the end:;To;; [I"a = ['a', 'b', 'c', 'd']
;TI"Ma.fill(-2) { |index| "new_#{index}" } # => ["a", "b", "new_2", "new_3"]
;T;
0o;
; [I"QIf start is too small (start <= -array.size, replaces all elements:;To;; [ I"a = ['a', 'b', 'c', 'd']
;TI"Ua.fill(-6) { |index| "new_#{index}" } # => ["new_0", "new_1", "new_2", "new_3"]
;TI"a = ['a', 'b', 'c', 'd']
;TI"Va.fill(-50) { |index| "new_#{index}" } # => ["new_0", "new_1", "new_2", "new_3"]
;T;
0o;
; [I"=With arguments +start+ and +length+, and a block given, ;TI"?calls the block for each index specified by start length; ;TI"Freplaces the corresponding element with the block's return value.;T@o;
; [I"TIf +start+ is in range, replaces +length+ elements beginning at offset +start+:;To;; [I"a = ['a', 'b', 'c', 'd']
;TI"Ka.fill(1, 1) { |index| "new_#{index}" } # => ["a", "new_1", "c", "d"]
;T;
0o;
; [I"/If start is negative, counts from the end:;To;; [I"a = ['a', 'b', 'c', 'd']
;TI"La.fill(-2, 1) { |index| "new_#{index}" } # => ["a", "b", "new_2", "d"]
;T;
0o;
; [I"SIf +start+ is large (start >= array.size), extends +self+ with +nil+:;To;; [ I"a = ['a', 'b', 'c', 'd']
;TI"La.fill(5, 0) { |index| "new_#{index}" } # => ["a", "b", "c", "d", nil]
;TI"a = ['a', 'b', 'c', 'd']
;TI"^a.fill(5, 2) { |index| "new_#{index}" } # => ["a", "b", "c", "d", nil, "new_5", "new_6"]
;T;
0o;
; [I"7If +length+ is zero or less, replaces no elements:;To;; [I"a = ['a', 'b', 'c', 'd']
;TI"Ga.fill(1, 0) { |index| "new_#{index}" } # => ["a", "b", "c", "d"]
;TI"Ha.fill(1, -1) { |index| "new_#{index}" } # => ["a", "b", "c", "d"]
;T;
0o;
; [I":With arguments +obj+ and +range+, and a block given, ;TI"9calls the block with each index in the given range; ;TI"Freplaces the corresponding element with the block's return value.;T@o;
; [I"ZIf the range is positive and ascending (range 0 < range.begin <= range.end, ;TI"Greplaces elements from range.begin to range.end:;To;; [I"a = ['a', 'b', 'c', 'd']
;TI"Ka.fill(1..1) { |index| "new_#{index}" } # => ["a", "new_1", "c", "d"]
;T;
0o;
; [I"0If +range.first+ is negative, does nothing:;To;; [I"a = ['a', 'b', 'c', 'd']
;TI"Na.fill(-1..1) { |index| fail 'Cannot happen' } # => ["a", "b", "c", "d"]
;T;
0o;
; [I"=If range.last is negative, counts from the end:;To;; [ I"a = ['a', 'b', 'c', 'd']
;TI"Ta.fill(0..-2) { |index| "new_#{index}" } # => ["new_0", "new_1", "new_2", "d"]
;TI"a = ['a', 'b', 'c', 'd']
;TI"Pa.fill(1..-2) { |index| "new_#{index}" } # => ["a", "new_1", "new_2", "d"]
;T;
0o;
; [I"HIf range.first and range.last are both negative, ;TI"both count from the end:;To;; [ I"a = ['a', 'b', 'c', 'd']
;TI"Ma.fill(-1..-1) { |index| "new_#{index}" } # => ["a", "b", "c", "new_3"]
;TI"a = ['a', 'b', 'c', 'd']
;TI"La.fill(-2..-2) { |index| "new_#{index}" } # => ["a", "b", "new_2", "d"];T;
0:
@fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I""array.fill(obj) -> self
array.fill(obj, start) -> self
array.fill(obj, start, length) -> self
array.fill(obj, range) -> self
array.fill {|index| ... } -> self
array.fill(start) {|index| ... } -> self
array.fill(start, length) {|index| ... } -> self
array.fill(range) {|index| ... } -> self
;T0[ I"(p1 = v1, p2 = v2);T@FI"
Array;TcRDoc::NormalClass00PK ]) map%21-i.rinu [ U:RDoc::AnyMethod[iI" map!:ETI"Array#map!;TF:privateo:RDoc::Markup::Document:@parts[
o:RDoc::Markup::Paragraph; [I"3Calls the block, if given, with each element; ;TI"8replaces the element with the block's return value:;To:RDoc::Markup::Verbatim; [I"a = [:foo, 'bar', 2]
;TI"Ga.map! { |element| element.class } # => [Symbol, String, Integer]
;T:@format0o;
; [I"1Returns a new \Enumerator if no block given:;To;; [I"a = [:foo, 'bar', 2]
;TI"a1 = a.map!
;TI"2a1 # => #
;T;0o;
; [I"/Array#collect! is an alias for Array#map!.;T:
@fileI"array.c;T:0@omit_headings_from_table_of_contents_below000[ I"();T@FI"
Array;TcRDoc::NormalClass0[@!FI"
collect!;TPK ]aZ Z difference-i.rinu [ U:RDoc::AnyMethod[iI"difference:ETI"Array#difference;TF:privateo:RDoc::Markup::Document:@parts[
o:RDoc::Markup::Paragraph; [I"EReturns a new \Array containing only those elements from +self+ ;TI"=that are not found in any of the Arrays +other_arrays+; ;TI"Mitems are compared using eql?; order from +self+ is preserved:;To:RDoc::Markup::Verbatim; [I"@[0, 1, 1, 2, 1, 1, 3, 1, 1].difference([1]) # => [0, 2, 3]
;TI"6[0, 1, 2, 3].difference([3, 0], [1, 3]) # => [2]
;TI".[0, 1, 2].difference([4]) # => [0, 1, 2]
;T:@format0o;
; [I"4Returns a copy of +self+ if no arguments given.;To:RDoc::Markup::BlankLine o;
; [I"Related: Array#-.;T:
@fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"2array.difference(*other_arrays) -> new_array
;T0[ I"(*args);T@FI"
Array;TcRDoc::NormalClass00PK ]?Zh h values_at-i.rinu [ U:RDoc::AnyMethod[iI"values_at:ETI"Array#values_at;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I":Returns a new \Array whose elements are the elements ;TI"9of +self+ at the given \Integer or \Range +indexes+.;To:RDoc::Markup::BlankLine o;
; [I"FFor each positive +index+, returns the element at offset +index+:;To:RDoc::Markup::Verbatim; [I"a = [:foo, 'bar', 2]
;TI"&a.values_at(0, 2) # => [:foo, 2]
;TI"*a.values_at(0..1) # => [:foo, "bar"]
;T:@format0o;
; [I"=The given +indexes+ may be in any order, and may repeat:;To;; [I"a = [:foo, 'bar', 2]
;TI"?a.values_at(2, 0, 1, 0, 2) # => [2, :foo, "bar", :foo, 2]
;TI"7a.values_at(1, 0..2) # => ["bar", :foo, "bar", 2]
;T;
0o;
; [I"4Assigns +nil+ for an +index+ that is too large:;To;; [I"a = [:foo, 'bar', 2]
;TI":a.values_at(0, 3, 1, 3) # => [:foo, nil, "bar", nil]
;T;
0o;
; [I"6Returns a new empty \Array if no arguments given.;T@o;
; [I"JFor each negative +index+, counts backward from the end of the array:;To;; [I"a = [:foo, 'bar', 2]
;TI"(a.values_at(-1, -3) # => [2, :foo]
;T;
0o;
; [I"4Assigns +nil+ for an +index+ that is too small:;To;; [I"a = [:foo, 'bar', 2]
;TI"Ba.values_at(0, -5, 1, -6, 2) # => [:foo, nil, "bar", nil, 2]
;T;
0o;
; [I"5The given +indexes+ may have a mixture of signs:;To;; [I"a = [:foo, 'bar', 2]
;TI";a.values_at(0, -2, 1, -1) # => [:foo, "bar", "bar", 2];T;
0:
@fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I",array.values_at(*indexes) -> new_array
;T0[ I"(*args);T@?FI"
Array;TcRDoc::NormalClass00PK ]l uniq%21-i.rinu [ U:RDoc::AnyMethod[iI"
uniq!:ETI"Array#uniq!;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"YRemoves duplicate elements from +self+, the first occurrence always being retained; ;TI"=returns +self+ if any elements removed, +nil+ otherwise.;To:RDoc::Markup::BlankLine o;
; [I"UWith no block given, identifies and removes elements using method eql? ;TI"to compare.;T@o;
; [I",Returns +self+ if any elements removed:;To:RDoc::Markup::Verbatim; [I"a = [0, 0, 1, 1, 2, 2]
;TI"a.uniq! # => [0, 1, 2]
;T:@format0o;
; [I"*Returns +nil+ if no elements removed.;T@o;
; [I";With a block given, calls the block for each element; ;TI"9identifies (using method eql?) and removes ;TI";elements for which the block returns duplicate values.;T@o;
; [I",Returns +self+ if any elements removed:;To;; [I".a = ['a', 'aa', 'aaa', 'b', 'bb', 'bbb']
;TI"?a.uniq! {|element| element.size } # => ['a', 'aa', 'aaa']
;T;
0o;
; [I"*Returns +nil+ if no elements removed.;T:
@fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"Larray.uniq! -> self or nil
array.uniq! {|element| ... } -> self or nil
;T0[ I"();T@-FI"
Array;TcRDoc::NormalClass00PK ]x/; ; take_while-i.rinu [ U:RDoc::AnyMethod[iI"take_while:ETI"Array#take_while;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"NReturns a new \Array containing zero or more leading elements of +self+; ;TI"does not modify +self+.;To:RDoc::Markup::BlankLine o;
; [I"QWith a block given, calls the block with each successive element of +self+; ;TI"2stops if the block returns +false+ or +nil+; ;TI"_returns a new Array containing those elements for which the block returned a truthy value:;To:RDoc::Markup::Verbatim; [ I"a = [0, 1, 2, 3, 4, 5]
;TI":a.take_while {|element| element < 3 } # => [0, 1, 2]
;TI" [0, 1, 2, 3, 4, 5]
;TI"a # => [0, 1, 2, 3, 4, 5]
;T:@format0o;
; [I"4With no block given, returns a new \Enumerator:;To;; [I"<[0, 1].take_while # => #;T;
0:
@fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"Warray.take_while {|element| ... } -> new_array
array.take_while -> new_enumerator
;T0[ I"();T@!FI"
Array;TcRDoc::NormalClass00PK ]| try_convert-c.rinu [ U:RDoc::AnyMethod[iI"try_convert:ETI"Array::try_convert;TT:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"7If +object+ is an \Array object, returns +object+.;To:RDoc::Markup::BlankLine o;
; [I"9Otherwise if +object+ responds to :to_ary, ;TI"9calls object.to_ary and returns the result.;T@o;
; [I"CReturns +nil+ if +object+ does not respond to :to_ary;T@o;
; [I"PRaises an exception unless object.to_ary returns an \Array object.;T:
@fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I" object, new_array, or nil
;T0[ I" (p1);T@FI"
Array;TcRDoc::NormalClass00PK ]I
$ $ dig-i.rinu [ U:RDoc::AnyMethod[iI"dig:ETI"Array#dig;TF:privateo:RDoc::Markup::Document:@parts[ o:RDoc::Markup::Paragraph; [ I"4Finds and returns the object in nested objects ;TI"5that is specified by +index+ and +identifiers+. ;TI"=The nested objects may be instances of various classes. ;TI"2See {Dig Methods}[rdoc-ref:dig_methods.rdoc].;To:RDoc::Markup::BlankLine o;
; [I"Examples:;To:RDoc::Markup::Verbatim; [
I",a = [:foo, [:bar, :baz, [:bat, :bam]]]
;TI".a.dig(1) # => [:bar, :baz, [:bat, :bam]]
;TI"#a.dig(1, 2) # => [:bat, :bam]
;TI"a.dig(1, 2, 0) # => :bat
;TI"a.dig(1, 2, 3) # => nil;T:@format0:
@fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I".array.dig(index, *identifiers) -> object
;T0[ I"(*args);T@FI"
Array;TcRDoc::NormalClass00PK ]v2Y Y sort_by%21-i.rinu [ U:RDoc::AnyMethod[iI"
sort_by!:ETI"Array#sort_by!;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I",Sorts the elements of +self+ in place, ;TI"=using an ordering determined by the block; returns self.;To:RDoc::Markup::BlankLine o;
; [I"3Calls the block with each successive element; ;TI"@sorts elements based on the values returned from the block.;T@o;
; [I"^For duplicates returned by the block, the ordering is indeterminate, and may be unstable.;T@o;
; [I"5This example sorts strings based on their sizes:;To:RDoc::Markup::Verbatim; [I"$a = ['aaaa', 'bbb', 'cc', 'd']
;TI"*a.sort_by! {|element| element.size }
;TI"'a # => ["d", "cc", "bbb", "aaaa"]
;T:@format0o;
; [I"1Returns a new \Enumerator if no block given:;T@o;; [I"$a = ['aaaa', 'bbb', 'cc', 'd']
;TI"Ga.sort_by! # => #;T;
0:
@fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"Narray.sort_by! {|element| ... } -> self
array.sort_by! -> new_enumerator
;T0[ I"();T@&FI"
Array;TcRDoc::NormalClass00PK ]