Class: RenderTurboStream::Channel
- Inherits:
-
Object
- Object
- RenderTurboStream::Channel
- Defined in:
- lib/render_turbo_stream/channel.rb
Instance Method Summary collapse
- #action=(action) ⇒ Object
-
#initialize(channel, partial: nil, template: nil, target_id: nil, action: :replace) ⇒ Channel
constructor
A new instance of Channel.
- #send(locals: {}) ⇒ Object
- #target_id=(target_id) ⇒ Object
- #test_responses ⇒ Object
Constructor Details
#initialize(channel, partial: nil, template: nil, target_id: nil, action: :replace) ⇒ Channel
Returns a new instance of Channel.
4 5 6 7 8 9 10 11 |
# File 'lib/render_turbo_stream/channel.rb', line 4 def initialize(channel, partial: nil, template: nil, target_id: nil, action: :replace) @channel = channel @partial = partial @template = template @target_id = target_id @action = action @test_responses = [] end |
Instance Method Details
#action=(action) ⇒ Object
17 18 19 |
# File 'lib/render_turbo_stream/channel.rb', line 17 def action=(action) @action = action end |
#send(locals: {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/render_turbo_stream/channel.rb', line 21 def send(locals: {}) libs = RenderTurboStream::ChannelLibs.new libs.render_to_channel( @channel, RenderTurboStream::Libs.target_id_to_target(@target_id), @action, template: @template, partial: @partial, locals: locals ) @test_responses = libs.test_responses end |
#target_id=(target_id) ⇒ Object
13 14 15 |
# File 'lib/render_turbo_stream/channel.rb', line 13 def target_id=(target_id) @target_id = target_id end |
#test_responses ⇒ Object
34 35 36 |
# File 'lib/render_turbo_stream/channel.rb', line 34 def test_responses @test_responses end |