Method: Concurrent::ImmutableStruct#select

Defined in:
lib/concurrent/immutable_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



68
69
70
71
# File 'lib/concurrent/immutable_struct.rb', line 68

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