Sha256: 82e64910e93a6dfd5f4b18419a571043d08f1e196a562760e14b6cda0ded21f3

Contents?: true

Size: 340 Bytes

Versions: 2

Compression:

Stored size: 340 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

2 entries across 2 versions & 1 rubygems

Version Path
presenting-2.0.0 lib/presenting/sanitize.rb
presenting-1.0.0 lib/presenting/sanitize.rb