Sha256: 18be1028b1d728678b2d219c32b549b15dd704794a7f405099967dc7048558c4
Contents?: true
Size: 1023 Bytes
Versions: 35
Compression:
Stored size: 1023 Bytes
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
35 entries across 35 versions & 2 rubygems