Module: ActionView::Helpers::CaptureHelper

Defined in:
lib/express_templates/components/content_for.rb

Instance Method Summary collapse

Instance Method Details

#capture(*args) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/express_templates/components/content_for.rb', line 19

def capture(*args)
  value = nil
  buffer = with_output_buffer { value = yield(*args) }
  value = value.to_s if value.is_a?(Arbre::Element) || value.is_a?(Arbre::ElementCollection)
  if string = buffer.presence || value and string.is_a?(String)
    ERB::Util.html_escape string
  end
end