Skip to content

Instantly share code, notes, and snippets.

@follmann
Created August 1, 2011 10:22
Show Gist options
  • Save follmann/1117903 to your computer and use it in GitHub Desktop.
Save follmann/1117903 to your computer and use it in GitHub Desktop.
content_for helper implementation for StaticMatic
module ContentHelper
# Usage example:
# set content for identifier javascript
# - content_for :javascript do
# :javascript
# //jscode
# recall with:
# = content_for :javascript
def content_for(name, &block)
@content_for ||= {}
if block_given?
@content_for[name] = capture_haml(&block)
else
@content_for[name]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment