Sha256: d88c62ebdbfa9478e40201272687f1d691af92727929434f121d0e1d22b42528
Contents?: true
Size: 1.2 KB
Versions: 10
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true require "pakyow/connection" require "pakyow/data/proxy" require "pakyow/data/sources/ephemeral" require "pakyow/realtime/channel" require "pakyow/ui/recordable" module Pakyow module UI # @api private class Handler def initialize(app) @app = app end def call(args, subscription: nil, result: nil) renderer = Marshal.restore(args[:metadata])[:renderer] renderer.presentables[:__ui_transform] = true # If an ephemeral caused the update, replace the value for any matching presentables. # if result.is_a?(Data::Sources::Ephemeral) renderer.presentables.each do |key, value| if value.is_a?(Data::Proxy) && value.source.is_a?(Data::Sources::Ephemeral) && value.source.type == result.type && value.source.qualifications == result.qualifications value.instance_variable_set(:@source, result) end end end renderer.perform @app.websocket_server.subscription_broadcast( Realtime::Channel.new(:transformation, subscription[:id]), { id: args[:transformation_id], calls: renderer.presenter } ) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems