Module: Thaum::Concerns::ContextUpdate

Included in:
App
Defined in:
lib/thaum/concerns/context_update.rb

Instance Method Summary collapse

Instance Method Details

#update_context(hash) ⇒ Object

— Context —



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/thaum/concerns/context_update.rb', line 8

def update_context(hash)
  cloned = deep_freeze(hash.dup)
  @context = cloned
  @in_on_update = true
  begin
    Tree.walk(self) do |node|
      next unless node.is_a?(Sigil) || node.is_a?(Octagram)

      node.on_update(cloned)
    end
    # Modal Sigil receives on_update last, after the layout tree.
    @modal_sigil&.on_update(cloned)
  ensure
    @in_on_update = false
  end
  request_render
end