Class: Temporalio::Internal::Worker::WorkflowInstance::ExternallyImmutableHash

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/temporalio/internal/worker/workflow_instance/externally_immutable_hash.rb

Overview

Delegator to a hash that does not allow external mutations. Used for memo.

Instance Method Summary collapse

Constructor Details

#initialize(initial_hash) ⇒ ExternallyImmutableHash

Returns a new instance of ExternallyImmutableHash.



9
10
11
# File 'lib/temporalio/internal/worker/workflow_instance/externally_immutable_hash.rb', line 9

def initialize(initial_hash)
  super(initial_hash.freeze)
end

Instance Method Details

#_update {|new_hash| ... } ⇒ Object

Yields:

  • (new_hash)


13
14
15
16
17
# File 'lib/temporalio/internal/worker/workflow_instance/externally_immutable_hash.rb', line 13

def _update(&)
  new_hash = __getobj__.dup
  yield new_hash
  __setobj__(new_hash.freeze)
end