Method: Concurrent::MutableStruct#merge

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

#merge(other) {|member, selfvalue, othervalue| ... } ⇒ Synchronization::AbstractStruct

Returns a new struct containing the contents of other and the contents of self. If no block is specified, the value for entries with duplicate keys will be that of other. Otherwise the value for each duplicate key is determined by calling the block with the key, its value in self and its value in other.

Parameters:

  • other (Hash)

    the hash from which to set the new values

Yields:

  • an options block for resolving duplicate keys

Yield Parameters:

  • member (String, Symbol)

    the name of the member which is duplicated

  • selfvalue (Object)

    the value of the member in self

  • othervalue (Object)

    the value of the member in other

Returns:

  • (Synchronization::AbstractStruct)

    a new struct with the new values

Raises:

  • (ArgumentError)

    of given a member that is not defined in the struct



94
95
96
# File 'lib/concurrent-ruby/concurrent/mutable_struct.rb', line 94

def merge(other, &block)
  synchronize { ns_merge(other, &block) }
end