Module: Rails::MultiBlockHelpers::CaptureSectionHelper

Extended by:
ActiveSupport::Concern
Defined in:
lib/rails/multi_block_helpers/capture_section_helper.rb

Instance Method Summary collapse

Instance Method Details

#capture_section(section, *args) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rails/multi_block_helpers/capture_section_helper.rb', line 10

def capture_section(section, *args)
  value = nil
  buffer = with_output_buffer { value = yield it_to(section) }
  if string = buffer.presence || value and string.is_a?(String)
    ERB::Util.html_escape string
  end
end