Module: SC::Helpers::CaptureHelper

Included in:
Builder::Html
Defined in:
lib/sproutcore/helpers/capture_helper.rb

Instance Method Summary collapse

Instance Method Details

#capture(*args, &block) ⇒ Object

Captures the resulting value of the block and returns it



15
16
17
# 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) ⇒ Object

executes the passed block, placing the resulting content into a variable called variable or by calling yield(:area_name)



23
24
25
26
# 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