Class: Julewire::Core::Execution::ScopeSnapshot
- Inherits:
-
Object
- Object
- Julewire::Core::Execution::ScopeSnapshot
- Defined in:
- lib/julewire/core/execution/scope_snapshot.rb
Instance Attribute Summary collapse
-
#lineage ⇒ Object
readonly
Returns the value of attribute lineage.
Instance Method Summary collapse
- #attributes_hash ⇒ Object
- #carry_hash ⇒ Object
- #context_hash ⇒ Object
- #execution_hash ⇒ Object
- #execution_reference_for_child ⇒ Object
- #finished_at ⇒ Object
- #frozen_execution_hash ⇒ Object
- #frozen_labels_hash ⇒ Object
- #id ⇒ Object
-
#initialize(execution: {}, carry: {}, attributes: {}, labels: {}, neutral: {}, lineage: nil) ⇒ ScopeSnapshot
constructor
A new instance of ScopeSnapshot.
- #labels_hash ⇒ Object
- #metrics_hash ⇒ Object
- #neutral_hash ⇒ Object
- #parent ⇒ Object
- #started_at ⇒ Object
- #summary_hash ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(execution: {}, carry: {}, attributes: {}, labels: {}, neutral: {}, lineage: nil) ⇒ ScopeSnapshot
Returns a new instance of ScopeSnapshot.
10 11 12 13 14 15 16 17 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 10 def initialize(execution: {}, carry: {}, attributes: {}, labels: {}, neutral: {}, lineage: nil) @execution = normalized_hash(execution) @carry = normalized_hash(carry) @attributes = normalized_hash(attributes) @neutral = normalized_hash(neutral) @labels = normalized_hash(labels) @lineage = lineage || Lineage.from_execution_hash(@execution) end |
Instance Attribute Details
#lineage ⇒ Object (readonly)
Returns the value of attribute lineage.
27 28 29 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 27 def lineage @lineage end |
Instance Method Details
#attributes_hash ⇒ Object
47 48 49 50 51 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 47 def attributes_hash return {} if @attributes.empty? Fields::FieldSet.deep_dup(@attributes) end |
#carry_hash ⇒ Object
41 42 43 44 45 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 41 def carry_hash return {} if @carry.empty? Fields::FieldSet.deep_dup(@carry) end |
#context_hash ⇒ Object
39 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 39 def context_hash = {} |
#execution_hash ⇒ Object
19 20 21 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 19 def execution_hash Fields::FieldSet.deep_dup(frozen_execution_hash) end |
#execution_reference_for_child ⇒ Object
75 76 77 78 79 80 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 75 def execution_reference_for_child reference = {} reference[:type] = @execution[:type] if @execution.key?(:type) reference[:id] = @execution[:id] if @execution.key?(:id) reference.empty? ? nil : Fields::Internal.frozen_copy(reference) end |
#finished_at ⇒ Object
35 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 35 def finished_at = nil |
#frozen_execution_hash ⇒ Object
23 24 25 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 23 def frozen_execution_hash @frozen_execution_hash ||= Fields::Internal.frozen_copy(@execution) end |
#frozen_labels_hash ⇒ Object
69 70 71 72 73 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 69 def frozen_labels_hash return EMPTY_HASH if @labels.empty? @frozen_labels_hash ||= Fields::Internal.frozen_copy(@labels) end |
#id ⇒ Object
29 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 29 def id = @execution[:id] |
#labels_hash ⇒ Object
59 60 61 62 63 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 59 def labels_hash return {} if @labels.empty? Fields::FieldSet.deep_dup(@labels) end |
#metrics_hash ⇒ Object
67 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 67 def metrics_hash = {} |
#neutral_hash ⇒ Object
53 54 55 56 57 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 53 def neutral_hash return {} if @neutral.empty? Fields::FieldSet.deep_dup(@neutral) end |
#parent ⇒ Object
37 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 37 def parent = nil |
#started_at ⇒ Object
33 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 33 def started_at = nil |
#summary_hash ⇒ Object
65 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 65 def summary_hash = {} |
#type ⇒ Object
31 |
# File 'lib/julewire/core/execution/scope_snapshot.rb', line 31 def type = @execution[:type] |