Class: Cuba

Inherits:
Object show all
Defined in:
lib/helpers/content_for.rb

Direct Known Subclasses

Embargo

Instance Method Summary collapse

Instance Method Details

#content_for(key, &block) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/helpers/content_for.rb', line 2

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