Sha256: b87e3f81ce7d454d12cd5cf8e00889c28e378c8e468da043eda9c360f0696092
Contents?: true
Size: 653 Bytes
Versions: 5
Compression:
Stored size: 653 Bytes
Contents
# frozen_string_literal: true module StimulusReflex module Broadcasters class Update include CableReady::Identifiable def initialize(key, value, reflex) @key = key @value = value @reflex = reflex end def selector @selector ||= identifiable?(@key) ? dom_id(@key) : @key.to_s end def html return @value unless defined?(ActiveRecord) html = @reflex.render(@key) if @key.is_a?(ActiveRecord::Base) && @value.nil? html = @reflex.render_collection(@key) if @key.is_a?(ActiveRecord::Relation) && @value.nil? html || @value end end end end
Version data entries
5 entries across 5 versions & 1 rubygems