Skip to content

Instantly share code, notes, and snippets.

@muloka
Forked from trooney/deferred yield.rb
Created July 28, 2014 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muloka/82bee94121e0f39b56d5 to your computer and use it in GitHub Desktop.
Save muloka/82bee94121e0f39b56d5 to your computer and use it in GitHub Desktop.
def yield_placeholder(name, content = nil, &block)
if content_for?(name)
concat @view_flow.get(name)
else
if block_given?
content = capture(&block)
end
concat content
end
end
def yield_block(name, content = nil, &block)
unless content_for?(name)
content_for(name) do
if block_given?
content = capture(&block)
end
content
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment