Linux heracles.o2switch.net 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
/
opt
/
alt
/
ruby27
/
share
/
ri
/
system
/
Array
/
//opt/alt/ruby27/share/ri/system/Array/fetch-i.ri
U:RDoc::AnyMethod[iI" fetch:ETI"Array#fetch;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [ I"OTries to return the element at position +index+, but throws an IndexError ;TI"Qexception if the referenced +index+ lies outside of the array bounds. This ;TI"Perror can be prevented by supplying a second argument, which will act as a ;TI"+default+ value.;To:RDoc::Markup::BlankLine o; ; [I"IAlternatively, if a block is given it will only be executed when an ;TI"#invalid +index+ is referenced.;T@o; ; [I"@Negative values of +index+ count from the end of the array.;T@o:RDoc::Markup::Verbatim; [I"a = [ 11, 22, 33, 44 ] ;TI"%a.fetch(1) #=> 22 ;TI"%a.fetch(-1) #=> 44 ;TI"(a.fetch(4, 'cat') #=> "cat" ;TI"5a.fetch(100) {|i| puts "#{i} is out of bounds"} ;TI"8 #=> "100 is out of bounds";T:@format0: @fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"�ary.fetch(index) -> obj ary.fetch(index, default) -> obj ary.fetch(index) {|index| block} -> obj ;T0[ I"(p1, p2 = v2);T@!FI" Array;TcRDoc::NormalClass00