# frozen_string_literal: true
#
# Copyright (c) 2006-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
#
# Ronin Support is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ronin Support is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Ronin Support. If not, see
one two
" # # @see http://rubydoc.info/stdlib/cgi/CGI.unescapeHash # @see Ronin::Support::Encoding::XML.unescape # # @since 0.2.0 # # @api public # def xml_unescape Ronin::Support::Encoding::XML.unescape(self) end # # Encodes each character in the String as an XML character. # # @param [Hash{Symbol => Object}] kwargs # Additional keyword arguments. # # @option kwargs [:decimal, :hex] :format (:decimal) # The numeric format for the escaped characters. # # @option kwargs [Boolean] :zero_pad # Controls whether the escaped characters will be left-padded with # up to seven `0` characters. # # @option kwargs [:lower, :upper, nil] :case # Controls whether to output lowercase or uppercase XML special # characters. Defaults to lowercase hexadecimal. # # @return [String] # The XML encoded String. # # @example # "abc".xml_encode # # => "abc" # # @example Zero-padding: # "abc".xml_encode(zero_pad: true) # # => "abc" # # @example Hexadecimal encoded characters: # "abc".xml_encode(format: :hex) # # => "abc" # # @example Uppercase hexadecimal encoded characters: # "abc\xff".xml_encode(format: :hex, case: :upper) # # => "abcÿ" # # @see Ronin::Support::Encoding::XML.encode # # @since 1.0.0 # # @api public # def xml_encode(**kwargs) Ronin::Support::Encoding::XML.encode(self,**kwargs) end alias xml_decode xml_unescape end