Sha256: b5054028f5435f538d4fd9005ff77eb4dbdcd0436285aecc4e70311bad010438

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

module ApplicationHelper
  def add_tag(name=nil, options={}, &block)
    if block_given?
      if block.arity == 1
        result = ActiveSupport::SafeBuffer.new
        def result.space(text)
          self << text
          self << ' '
        end
        def result.add(text)
          self << text
        end
        block.call(result)
        if name
          content_tag(name, options) do
            result
          end
        else
          result
        end
      else
        if name
          content_tag(name, options) do
            block.call
          end
        else
          block.call
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_extras-0.0.1 lib/application_helper.rb