Class: LcpRuby::Pages::ScopeContextResolver
- Inherits:
-
Object
- Object
- LcpRuby::Pages::ScopeContextResolver
- Defined in:
- lib/lcp_ruby/pages/scope_context_resolver.rb
Overview
Resolves the ‘scope_context:` hash on page zones. Values prefixed with `:` are treated as dynamic references (parsed via DynamicReferences::Resolver); everything else passes through as a literal.
Constant Summary collapse
- DYNAMIC_PREFIX =
":"
Instance Method Summary collapse
-
#initialize(scope_context, record:, user:, selection_id: nil) ⇒ ScopeContextResolver
constructor
A new instance of ScopeContextResolver.
- #resolve ⇒ Object
Constructor Details
#initialize(scope_context, record:, user:, selection_id: nil) ⇒ ScopeContextResolver
Returns a new instance of ScopeContextResolver.
9 10 11 12 13 14 |
# File 'lib/lcp_ruby/pages/scope_context_resolver.rb', line 9 def initialize(scope_context, record:, user:, selection_id: nil) @scope_context = scope_context @record = record @user = user @selection_id = selection_id end |
Instance Method Details
#resolve ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/lcp_ruby/pages/scope_context_resolver.rb', line 16 def resolve return {} if @scope_context.blank? @scope_context.each_with_object({}) do |(key, value), resolved| resolved[key] = resolve_value(value) end end |