Module: Cuba::Render

Defined in:
lib/embargo.rb

Instance Method Summary collapse

Instance Method Details

#content_for(key, &block) ⇒ Object


60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/embargo.rb', line 60

def content_for(key, &block)
  if block
    @_content_for ||= {}
    buf_was = @haml_buffer.buffer
    @haml_buffer.buffer = ''
    yield
    @_content_for[key] = @haml_buffer.buffer
    @haml_buffer.buffer = buf_was
  elsif @_content_for
    @_content_for[key]
  end
end