Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added content_for? check, no tests though #662

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 18 additions & 1 deletion padrino-helpers/lib/padrino-helpers/output_helpers.rb
Expand Up @@ -129,7 +129,24 @@ def yield_content(key, *args)
return nil if blocks.empty?
blocks.map { |content| capture_html(*args, &content) }.join
end


##
# Is there a content block for a given key?
#
# @param [Symbol] key
# Name of content to yield
#
# @return [TrueClass,FalseClass] Result html for the given +key+
#
# @example
# content_for? :header
#
# @api public
def content_for?(key)
blocks = content_blocks[key.to_sym]
!(blocks.nil? || blocks.empty?)
end

protected
##
# Retrieves content_blocks stored by content_for or within yield_content
Expand Down