Class: Fixnum

Inherits:
Object show all
Defined in:
lib/active_support/vendor/builder/xchar.rb

Overview

Enhance the Fixnum class with a XML escaped character conversion.

Constant Summary collapse

XChar =

:nodoc:

Builder::XChar

Instance Method Summary collapse

Instance Method Details

#xchrObject

XML escaped version of chr



93
94
95
96
97
# File 'lib/active_support/vendor/builder/xchar.rb', line 93

def xchr
  n = XChar::CP1252[self] || self
  n = 42 unless XChar::VALID.find {|range| range.include? n}
  XChar::PREDEFINED[n] or (n<128 ? n.chr : "&##{n};")
end