Module: TurboReady::TagHelper
- Included in:
- BroadcastInvokeJob, Patches::Broadcasts, Patches::TagBuilder, StringWrapper
- Defined in:
- lib/turbo_ready/tag_helper.rb
Instance Method Summary collapse
Instance Method Details
#turbo_stream_invoke_tag(method, args: [], selector: nil, camelize: true, id: nil) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/turbo_ready/tag_helper.rb', line 4 def turbo_stream_invoke_tag(method, args: [], selector: nil, camelize: true, id: nil) id = SecureRandom.uuid if id.blank? payload = HashWithIndifferentAccess.new(id: id.to_s, selector: selector) payload.merge! method_details(method, args: args, camelize: camelize) payload.select! { |_, v| v.present? } %(<turbo-stream action="invoke" target="DOM"><template>#{payload.to_json}</template></turbo-stream>).html_safe end |