Method: Functional::Tuple#at

Defined in:
lib/functional/tuple.rb

#at(index) ⇒ Object Also known as: nth, []

Retrieve the item at the given index. Indices begin at zero and increment up, just like Ruby arrays. Negative indicies begin at -1, which represents the last item in the tuple, and decrement toward the first item. If the given index is out of range then ‘nil` is returned.

Parameters:

  • index (Fixnum)

    the index of the item to be retrieved

Returns:

  • (Object)

    the item at the given index or nil when index is out of bounds



53
54
55
# File 'lib/functional/tuple.rb', line 53

def at(index)
  @data[index]
end