Created
August 1, 2011 10:22
-
-
Save follmann/1117903 to your computer and use it in GitHub Desktop.
content_for helper implementation for StaticMatic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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