--- !ruby/object:RI::MethodDescription aliases: [] block_params: comment: - !ruby/struct:SM::Flow::P body: Tries to return the element at position index. If the index lies outside the array, the first form throws an IndexError exception, the second form returns default, and the third form returns the value of invoking the block, passing in the index. Negative values of index count from the end of the array. - !ruby/struct:SM::Flow::VERB body: " a = [ 11, 22, 33, 44 ]\n a.fetch(1) #=> 22\n a.fetch(-1) #=> 44\n a.fetch(4, 'cat') #=> "cat"\n a.fetch(4) { |i| i*i } #=> 16\n" full_name: Array#fetch is_singleton: false name: fetch params: | array.fetch(index) -> obj array.fetch(index, default ) -> obj array.fetch(index) {|index| block } -> obj visibility: public