Class: Cybertrain::TurboStreams
- Inherits:
-
Object
- Object
- Cybertrain::TurboStreams
- Defined in:
- cybertrain/turbo_stream_renderer.rb
Instance Method Summary collapse
-
#after(target, partial: "", locals: {}, html: nil) ⇒ SafeString
Inserted after the target (see #replace).
-
#append(target, partial: "", locals: {}, html: nil) ⇒ SafeString
Added at the end of the target’s content (see #replace).
-
#before(target, partial: "", locals: {}, html: nil) ⇒ SafeString
Inserted before the target (see #replace).
-
#prepend(target, partial: "", locals: {}, html: nil) ⇒ SafeString
Added at the start of the target’s content (see #replace).
-
#remove(target) ⇒ SafeString
<turbo-stream action="remove" target="...">. -
#replace(target, partial: "", locals: {}, html: nil) ⇒ SafeString
<turbo-stream action="replace" target="...">: the target (a DOM id String, or a record, whose dom_id it is) replaced by exactly one of the partial (with its locals) andhtml:(escaped unless a SafeString). -
#update(target, partial: "", locals: {}, html: nil) ⇒ SafeString
The target’s content replaced (see #replace for the arguments).
Instance Method Details
#after(target, partial: "", locals: {}, html: nil) ⇒ SafeString
Inserted after the target (see #replace).
76 77 78 |
# File 'cybertrain/turbo_stream_renderer.rb', line 76 def after(target, partial: "", locals: {}, html: nil) stream("after", target, partial, locals, html) end |
#append(target, partial: "", locals: {}, html: nil) ⇒ SafeString
Added at the end of the target’s content (see #replace).
55 56 57 |
# File 'cybertrain/turbo_stream_renderer.rb', line 55 def append(target, partial: "", locals: {}, html: nil) stream("append", target, partial, locals, html) end |
#before(target, partial: "", locals: {}, html: nil) ⇒ SafeString
Inserted before the target (see #replace).
69 70 71 |
# File 'cybertrain/turbo_stream_renderer.rb', line 69 def before(target, partial: "", locals: {}, html: nil) stream("before", target, partial, locals, html) end |
#prepend(target, partial: "", locals: {}, html: nil) ⇒ SafeString
Added at the start of the target’s content (see #replace).
62 63 64 |
# File 'cybertrain/turbo_stream_renderer.rb', line 62 def prepend(target, partial: "", locals: {}, html: nil) stream("prepend", target, partial, locals, html) end |
#remove(target) ⇒ SafeString
<turbo-stream action="remove" target="...">.
84 85 86 |
# File 'cybertrain/turbo_stream_renderer.rb', line 84 def remove(target) Turbo.remove(target) end |
#replace(target, partial: "", locals: {}, html: nil) ⇒ SafeString
<turbo-stream action="replace" target="...">: the target (a DOM id
String, or a record, whose dom_id it is) replaced by exactly one of
the partial (with its locals) and html: (escaped unless a
SafeString).
41 42 43 |
# File 'cybertrain/turbo_stream_renderer.rb', line 41 def replace(target, partial: "", locals: {}, html: nil) stream("replace", target, partial, locals, html) end |
#update(target, partial: "", locals: {}, html: nil) ⇒ SafeString
The target’s content replaced (see #replace for the arguments).
48 49 50 |
# File 'cybertrain/turbo_stream_renderer.rb', line 48 def update(target, partial: "", locals: {}, html: nil) stream("update", target, partial, locals, html) end |