Module: Motion::Component::Rendering
- Included in:
- Motion::Component
- Defined in:
- lib/motion/component/rendering.rb
Instance Method Summary collapse
- #awaiting_forced_rerender? ⇒ Boolean
-
#render_hash ⇒ Object
-
This can be overwritten.
-
- #render_in(view_context) ⇒ Object
- #rerender! ⇒ Object
Instance Method Details
#awaiting_forced_rerender? ⇒ Boolean
39 40 41 |
# File 'lib/motion/component/rendering.rb', line 39 def awaiting_forced_rerender? @_awaiting_forced_rerender end |
#render_hash ⇒ Object
-
This can be overwritten.
-
It will not be sent to the client.
-
If it doesn’t change every time the component’s state changes, things may fall out of sync unless you also call ‘#rerender!`
47 48 49 |
# File 'lib/motion/component/rendering.rb', line 47 def render_hash Motion.serializer.weak_digest(self) end |
#render_in(view_context) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/motion/component/rendering.rb', line 51 def render_in(view_context) raise BlockNotAllowedError, self if block_given? html = _run_action_callbacks(context: :render) { _clear_awaiting_forced_rerender! view_context.capture { super } } raise RenderAborted, self unless html Motion.markup_transformer.add_state_to_html(self, html) end |
#rerender! ⇒ Object
35 36 37 |
# File 'lib/motion/component/rendering.rb', line 35 def rerender! @_awaiting_forced_rerender = true end |