Sha256: 8bc502298f4da059cd8b915a858d5a1df60eab0e3ee117b08c45bec1d604179f
Contents?: true
Size: 1 KB
Versions: 13
Compression:
Stored size: 1 KB
Contents
# =========================================================================== # Project: Abbot - SproutCore Build Tools # Copyright: ©2009 Apple, Inc. # portions copyright @2006-2009 Sprout Systems, Inc. # and contributors # =========================================================================== module SC module Helpers module CaptureHelper # Captures the resulting value of the block and returns it def capture(*args, &block) self.renderer ? self.renderer.capture(args, &block) : block.call(*args).to_s end # 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) # def content_for(name, &block) eval "@content_for_#{name} = (@content_for_#{name} || '') + (capture(&block) || '')" return '' # incase user does <%= content_for ... %> end end end end
Version data entries
13 entries across 13 versions & 1 rubygems