⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.133
Server IP:
185.119.109.197
Server:
Linux managedhosting.chostar.me 5.15.0-160-generic #170-Ubuntu SMP Wed Oct 1 10:06:56 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.1.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
usr
/
share
/
ri
/
3.0.0
/
system
/
Array
/
Edit File: fill-i.ri
U:RDoc::AnyMethod[iI" fill:ETI"Array#fill;TF:publico: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 (<tt>0 <= start < array.size</tt>), ;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 (<tt>start >= array.size</tt>), 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 <tt>start + array.size</tt>):;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 (<tt>start >= array.size</tt>), 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 (<tt>0 < range.begin <= range.end</tt>), ;TI"Greplaces elements from <tt>range.begin</tt> to <tt>range.end</tt>:;To;; [I"a = ['a', 'b', 'c', 'd'] ;TI"1a.fill(:X, (1..1)) # => ["a", :X, "c", "d"] ;T; 0o; ; [I"?If <tt>range.first</tt> 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 <tt>range.last</tt> 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 <tt>range.last</tt> and <tt>range.last</tt> 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 (<tt>0 <= start < array.size</tt>), ;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(<tt>start >= array.size</tt>), 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 (<tt>start <= -array.size</tt>, 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 (<tt>start >= array.size</tt>), 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 (<tt>range 0 < range.begin <= range.end</tt>, ;TI"Greplaces elements from <tt>range.begin</tt> to <tt>range.end</tt>:;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 <tt>range.last</tt> 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 <tt>range.first</tt> and <tt>range.last</tt> 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::NormalClass00
Simpan