Class: Julewire::Core::Execution::ScopeFields
- Inherits:
-
Object
- Object
- Julewire::Core::Execution::ScopeFields
- Defined in:
- lib/julewire/core/execution/scope_fields.rb
Instance Attribute Summary collapse
-
#stacks ⇒ Object
readonly
Returns the value of attribute stacks.
Instance Method Summary collapse
- #add(section, fields, owned:) ⇒ Object
- #attributes_hash ⇒ Object
- #carry_hash ⇒ Object
- #context_hash ⇒ Object
- #delete(section, path) ⇒ Object
- #field_hash(section) ⇒ Object
- #field_stack(section) ⇒ Object
- #frozen_labels_hash ⇒ Object
-
#initialize(context:, attributes:, labels:, carry:, neutral:) ⇒ ScopeFields
constructor
A new instance of ScopeFields.
- #labels_hash ⇒ Object
- #neutral_hash ⇒ Object
- #with(section, fields, owned:, **keyword_fields) ⇒ Object
- #without(section, path) ⇒ Object
Constructor Details
#initialize(context:, attributes:, labels:, carry:, neutral:) ⇒ ScopeFields
Returns a new instance of ScopeFields.
9 10 11 12 13 14 15 16 17 |
# File 'lib/julewire/core/execution/scope_fields.rb', line 9 def initialize(context:, attributes:, labels:, carry:, neutral:) @stacks = Fields::StackSet.new( context: context, carry: carry, attributes: attributes, neutral: neutral ) @labels = normalized_static_hash(labels) end |
Instance Attribute Details
#stacks ⇒ Object (readonly)
Returns the value of attribute stacks.
7 8 9 |
# File 'lib/julewire/core/execution/scope_fields.rb', line 7 def stacks @stacks end |
Instance Method Details
#add(section, fields, owned:) ⇒ Object
43 44 45 |
# File 'lib/julewire/core/execution/scope_fields.rb', line 43 def add(section, fields, owned:) @stacks.add(section, fields, owned: owned) end |
#attributes_hash ⇒ Object
23 |
# File 'lib/julewire/core/execution/scope_fields.rb', line 23 def attributes_hash = @stacks.snapshot(:attributes) |
#carry_hash ⇒ Object
21 |
# File 'lib/julewire/core/execution/scope_fields.rb', line 21 def carry_hash = @stacks.snapshot(:carry) |
#context_hash ⇒ Object
19 |
# File 'lib/julewire/core/execution/scope_fields.rb', line 19 def context_hash = @stacks.snapshot(:context) |
#delete(section, path) ⇒ Object
47 48 49 |
# File 'lib/julewire/core/execution/scope_fields.rb', line 47 def delete(section, path) @stacks.delete(section, path) end |
#field_hash(section) ⇒ Object
27 28 29 |
# File 'lib/julewire/core/execution/scope_fields.rb', line 27 def field_hash(section) @stacks.snapshot(section) end |
#field_stack(section) ⇒ Object
31 32 33 |
# File 'lib/julewire/core/execution/scope_fields.rb', line 31 def field_stack(section) @stacks.stack(section) end |
#frozen_labels_hash ⇒ Object
39 40 41 |
# File 'lib/julewire/core/execution/scope_fields.rb', line 39 def frozen_labels_hash @frozen_labels_hash ||= Fields::Internal.frozen_copy(@labels) end |
#labels_hash ⇒ Object
35 36 37 |
# File 'lib/julewire/core/execution/scope_fields.rb', line 35 def labels_hash Fields::FieldSet.deep_dup(@labels) end |
#neutral_hash ⇒ Object
25 |
# File 'lib/julewire/core/execution/scope_fields.rb', line 25 def neutral_hash = @stacks.snapshot(:neutral) |
#with(section, fields, owned:, **keyword_fields) ⇒ Object
51 52 53 |
# File 'lib/julewire/core/execution/scope_fields.rb', line 51 def with(section, fields, owned:, **keyword_fields, &) @stacks.with(section, fields, owned: owned, **keyword_fields, &) end |
#without(section, path) ⇒ Object
55 56 57 |
# File 'lib/julewire/core/execution/scope_fields.rb', line 55 def without(section, path, &) @stacks.without(section, path, &) end |