Sha256: a1148a37809c3b7072ae9c464a05e5dcd4bdc62bf72655e5fb67d2b24d502004

Contents?: true

Size: 848 Bytes

Versions: 252

Compression:

Stored size: 848 Bytes

Contents

##
## $Release: 2.7.0 $
## copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
##


module Erubis

  ##
  ## helper for xml
  ##
  module XmlHelper

    module_function

    ESCAPE_TABLE = {
      '&' => '&',
      '<' => '&lt;',
      '>' => '&gt;',
      '"' => '&quot;',
      "'" => '&#039;',
    }

    def escape_xml(value)
      value.to_s.gsub(/[&<>"]/) { |s| ESCAPE_TABLE[s] }   # or /[&<>"']/
      #value.to_s.gsub(/[&<>"]/) { ESCAPE_TABLE[$&] }
    end

    def escape_xml2(value)
      return value.to_s.gsub(/\&/,'&amp;').gsub(/</,'&lt;').gsub(/>/,'&gt;').gsub(/"/,'&quot;')
    end

    alias h escape_xml
    alias html_escape escape_xml

    def url_encode(str)
      return str.gsub(/[^-_.a-zA-Z0-9]+/) { |s|
        s.unpack('C*').collect { |i| "%%%02X" % i }.join
      }
    end

    alias u url_encode

  end


end

Version data entries

252 entries across 212 versions & 42 rubygems

Version Path
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/brakeman-4.7.2/bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/brakeman-4.7.0/bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/erubis-2.7.0/lib/erubis/helper.rb
brakeman-4.7.2 bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.7.0/bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/erubis-2.7.0/lib/erubis/helper.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.7.1/bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb
brakeman-4.7.1 bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.7.0/bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/erubis-2.7.0/lib/erubis/helper.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb
brakeman-4.7.0 bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/erubis-2.7.0/lib/erubis/helper.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helper.rb