Module: Lifeform::CapturingRenderable

Included in:
Form, Libraries::Default::Button, Libraries::Default::Input
Defined in:
lib/lifeform/capturing_renderable.rb

Instance Method Summary collapse

Instance Method Details

#render_in(view_context, &block) ⇒ Object

NOTE: the previous ‘with_output_buffer` stuff is for some reason incompatible with Serbea. So we’ll use a simpler capture.



7
8
9
10
11
12
13
14
15
# File 'lib/lifeform/capturing_renderable.rb', line 7

def render_in(view_context, &block)
  if block
    call(view_context: view_context) do |*args, **kwargs|
      unsafe_raw(view_context.capture(*args, **kwargs, &block))
    end.html_safe
  else
    call(view_context: view_context).html_safe
  end
end