Module: ContentTagHelper

Defined in:
lib/ecrire/app/helpers/content_tag_helper.rb

Defined Under Namespace

Classes: Tag

Instance Method Summary collapse

Instance Method Details

#content_tag(*args, &block) ⇒ Object



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

def (*args, &block)
  if block_given?
    tag = Tag.new(*args)
    old_buf = @output_buffer
    @output_buffer = ActionView::OutputBuffer.new
    value = yield(tag)
    content = tag.render(@output_buffer.presence || value)
    @output_buffer = old_buf
    content
  else
    super
  end
end