Method: Concurrent::SettableStruct#select

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

#select {|value| ... } ⇒ Array

Yields each member value from the struct to the block and returns an Array containing the member values from the struct for which the given block returns a true value (equivalent to ‘Enumerable#select`).

Yields:

  • the operation to be performed on each struct member

Yield Parameters:

  • value (Object)

    each struct value (in order)

Returns:

  • (Array)

    an array containing each value for which the block returns true



67
68
69
70
# File 'lib/concurrent-ruby/concurrent/settable_struct.rb', line 67

def select(&block)
  return enum_for(:select) unless block_given?
  synchronize { ns_select(&block) }
end