class Integer

Enhance the Integer class with a XML escaped character conversion.

Constants

XChar

Public Instance Methods

xchr(escape=true) click to toggle source

XML escaped version of chr. When escape is set to false the CP1252 fix is still applied but utf-8 characters are not converted to character entities.

    # File lib/builder/xchar.rb
172 def xchr(escape=true)
173   n = XChar::CP1252[self] || self
174   case n when *XChar::VALID
175     XChar::PREDEFINED[n] or 
176       (n<128 ? n.chr : (escape ? "&##{n};" : [n].pack('U*')))
177   else
178     Builder::XChar::REPLACEMENT_CHAR
179   end
180 end