Method: Concurrent::Tuple#set

Defined in:
lib/concurrent-ruby/concurrent/tuple.rb

#set(i, value) ⇒ Object Also known as: volatile_set

Set the element at the given index to the given value

Parameters:

  • i (Integer)

    the index for the element to set

  • value (Object)

    the value to set at the given index

Returns:

  • (Object)

    the new value of the element at the given index or nil if the index is out of bounds



55
56
57
58
# File 'lib/concurrent-ruby/concurrent/tuple.rb', line 55

def set(i, value)
  return nil if i >= @size || i < 0
  @tuple[i].set(value)
end