module SC::Helpers::CaptureHelper

Public Instance Methods

capture(*args, &block) click to toggle source

Captures the resulting value of the block and returns it

# File lib/sproutcore/helpers/capture_helper.rb, line 15
def capture(*args, &block)
  self.renderer ? self.renderer.capture(args, &block) : block.call(*args).to_s
end
content_for(name, &block) click to toggle source

executes the passed block, placing the resulting content into a variable called @content_for_area_name. You can insert this content later by including this variable or by calling yield(:area_name)

# File lib/sproutcore/helpers/capture_helper.rb, line 23
def content_for(name, &block)
  eval "@content_for_#{name} = (@content_for_#{name} || '') + (capture(&block) || '')", binding, __FILE__, __LINE__
  return '' # incase user does <%= content_for ... %>
end