aboutsummaryrefslogblamecommitdiffstats
path: root/actionpack/lib/action_view/safe_buffer.rb
blob: 09f44ab26fefc1a472fe9e4209a87300cf14bd54 (plain) (tree)
1
2
3
4
5
6
7
8






                           
                                 



















                     
module ActionView #:nodoc:
  class SafeBuffer < String
    def <<(value)
      if value.html_safe?
        super(value)
      else
        super(ERB::Util.h(value))
      end
    end

    def concat(value)
      self << value
    end

    def html_safe?
      true
    end

    def html_safe!
      self
    end

    def to_s
      self
    end
  end
end