render_turbo_stream 4.4.0 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/render_turbo_stream/channel.rb +42 -40
- data/lib/render_turbo_stream/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2751555dcedccddcd194a704306282dd4a7f9e8dfce3da98fff1f3f43008826b
|
4
|
+
data.tar.gz: 40c7a231488efdd817a0143234188189e51c9dd27917c22858c637e7cce823ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c31b229cf1e1b14915c20e0a8b93ee5fe5f685fd3e1a2ae9b07d335d7b7a0b84a84b72138fa40e2ea71aa280f38cb66565ed3a3906e87d3d6f86b7ee0b58a15
|
7
|
+
data.tar.gz: a8fd505b93f9ebe97b1fcac9540bf4bd6bdc8181f05b4ba719dda2c38fb0984c4b2d8ece9b023e95f2ae218cca10db0838807679bada4a3820350abeac05bd94
|
@@ -1,43 +1,45 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
module RenderTurboStream
|
2
|
+
class Channel
|
3
|
+
|
4
|
+
def initialize(channel, partial: nil, template: nil, target_id: nil, action: :replace)
|
5
|
+
@channel = channel
|
6
|
+
@partial = partial
|
7
|
+
@template = template
|
8
|
+
@target_id = target_id
|
9
|
+
@action = action
|
10
|
+
@test_responses = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def target_id=(target_id)
|
14
|
+
@target_id = target_id
|
15
|
+
end
|
16
|
+
|
17
|
+
def action=(action)
|
18
|
+
@action = action
|
19
|
+
end
|
20
|
+
|
21
|
+
def send(locals: {})
|
22
|
+
libs = RenderTurboStream::ChannelLibs.new
|
23
|
+
libs.render_to_channel(
|
24
|
+
@channel,
|
25
|
+
RenderTurboStream::Libs.target_id_to_target(@target_id),
|
26
|
+
@action,
|
27
|
+
template: @template,
|
28
|
+
partial: @partial,
|
29
|
+
locals: locals
|
30
|
+
)
|
31
|
+
@test_responses = libs.test_responses
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_responses
|
35
|
+
@test_responses
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def validate_params
|
41
|
+
raise 'Arguments partial and template cannot both be specified' if @partial && @template
|
42
|
+
end
|
15
43
|
|
16
|
-
def action=(action)
|
17
|
-
@action = action
|
18
44
|
end
|
19
|
-
|
20
|
-
def send(locals: {})
|
21
|
-
libs = RenderTurboStream::ChannelLibs.new
|
22
|
-
libs.render_to_channel(
|
23
|
-
@channel,
|
24
|
-
RenderTurboStream::Libs.target_id_to_target(@target_id),
|
25
|
-
@action,
|
26
|
-
template: @template,
|
27
|
-
partial: @partial,
|
28
|
-
locals: locals
|
29
|
-
)
|
30
|
-
@test_responses = libs.test_responses
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_responses
|
34
|
-
@test_responses
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def validate_params
|
40
|
-
raise 'Arguments partial and template cannot both be specified' if @partial && @template
|
41
|
-
end
|
42
|
-
|
43
45
|
end
|