This is a helper method I found in the ruby on rails application spree commerce.
I'm trying to better understand what's going on here, particularly with the capture() method on line 12, which I've never seen before. If there is a block given, it captures it, otherwise there is no content. But where does capture() come from? what is it doing?
11 def hook(hook_name, locals = {}, &block)
12 content = block_given? ? capture(&block) : ''
13 result = Spree::ThemeSupport::Hook.render_hook(hook_name, content, self, locals)
14 block_given? ? concat(result.to_s) : result
15 end