📁 File Manager Pro
v10.0.3 | PHP: 8.1.34
Server: Apache
2026-06-22 03:42:50
📂
/ (Root)
/
opt
/
alt
/
ruby30
/
share
/
ri
/
system
/
Array
📍 /opt/alt/ruby30/share/ri/system/Array
🔄 Refresh
✏️
Editing: fetch-i.ri
Read Only
U:RDoc::AnyMethod[iI" fetch:ETI"Array#fetch;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I",Returns the element at offset +index+.;To:RDoc::Markup::BlankLine o; ; [I"0With the single \Integer argument +index+, ;TI"+returns the element at offset +index+:;To:RDoc::Markup::Verbatim; [I"a = [:foo, 'bar', 2] ;TI"a.fetch(1) # => "bar" ;T:@format0o; ; [I">If +index+ is negative, counts from the end of the array:;To;; [I"a = [:foo, 'bar', 2] ;TI"a.fetch(-1) # => 2 ;TI"a.fetch(-2) # => "bar" ;T; 0o; ; [I"1With arguments +index+ and +default_value+, ;TI"Areturns the element at offset +index+ if index is in range, ;TI"'otherwise returns +default_value+:;To;; [I"a = [:foo, 'bar', 2] ;TI" a.fetch(1, nil) # => "bar" ;T; 0o; ; [I"(With argument +index+ and a block, ;TI"@returns the element at offset +index+ if index is in range ;TI"f(and the block is not called); otherwise calls the block with index and returns its return value:;T@o;; [I"a = [:foo, 'bar', 2] ;TI"<a.fetch(1) {|index| raise 'Cannot happen' } # => "bar" ;TI"Da.fetch(50) {|index| "Value for #{index}" } # => "Value for 50";T; 0: @fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"}array.fetch(index) -> element array.fetch(index, default_value) -> element array.fetch(index) {|index| ... } -> element ;T0[ I"(p1, p2 = v2);T@2FI" Array;TcRDoc::NormalClass00
💾 Save Changes
❌ Cancel