This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.
# Array.fetch (from ruby core) --- array.fetch(index) -> element array.fetch(index, default_value) -> element array.fetch(index) {|index| ... } -> element --- Returns the element at offset `index`. With the single Integer argument `index`, returns the element at offset `index`: a = [:foo, 'bar', 2] a.fetch(1) # => "bar" If `index` is negative, counts from the end of the array: a = [:foo, 'bar', 2] a.fetch(-1) # => 2 a.fetch(-2) # => "bar" With arguments `index` and `default_value`, returns the element at offset `index` if index is in range, otherwise returns `default_value`: a = [:foo, 'bar', 2] a.fetch(1, nil) # => "bar" With argument `index` and a block, returns the element at offset `index` if index is in range (and the block is not called); otherwise calls the block with index and returns its return value: a = [:foo, 'bar', 2] a.fetch(1) {|index| raise 'Cannot happen' } # => "bar" a.fetch(50) {|index| "Value for #{index}" } # => "Value for 50"
This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.