Created
April 29, 2016 10:55
-
-
Save samrayner/9ca59a21c8d47e76c23bea0e34fd3435 to your computer and use it in GitHub Desktop.
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
def default_content_for(name, content = nil, options = {}, &block) | |
if name.is_a? Hash | |
name.each { |k, v| content_for(k, v) unless content_for?(k) } | |
elsif content || block_given? | |
content_for(name, content, options, &block) unless content_for?(name) | |
else | |
raise(ArgumentError, 'expected a second argument or block for the default content') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment