Sha256: cb4e32a21881c64660a79917b1a4f1f7fb14f4ff0a02dcc9e2c339684746c799

Contents?: true

Size: 353 Bytes

Versions: 4

Compression:

Stored size: 353 Bytes

Contents

module Presenting::Sanitize
  class << self
    include ERB::Util
    
    # escape but preserve Arrays and Hashes
    def h(val)
      case val
      when Array
        val.map{|i| h(i)}
        
      when Hash
        val.clone.each{|k, v| val[h(k)] = h(v)}
        
      else
        html_escape(val)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
presenting-3.0.0 lib/presenting/sanitize.rb
presenting-2.1.0 lib/presenting/sanitize.rb
presenting-2.0.3 lib/presenting/sanitize.rb
presenting-2.0.2 lib/presenting/sanitize.rb