Sha256: 234210b860dcf61fa63afd3e3569d2e46b344e59289fecb3a14e6d81c78bc2c5

Contents?: true

Size: 434 Bytes

Versions: 2

Compression:

Stored size: 434 Bytes

Contents

module Simply
  module Escaping
    #
    # A utility method for escaping HTML tag characters in _s_.
    # 
    #  Taken from ERB::Util
    # 	
    # 	puts html_escape("is a > 0 & a < 10?")
    # 
    # _Generates_
    # 
    # 	is a &gt; 0 &amp; a &lt; 10?
    #
    def html_escape(s)
      s.to_s.gsub(/&/, "&amp;").gsub(/\"/, "&quot;").gsub(/>/, "&gt;").gsub(/</, "&lt;")
    end
    
    alias_method :h, :html_escape
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
smtlaissezfaire-simply-0.2.1 lib/simply/escaping.rb
simply-0.2.3 lib/simply/escaping.rb