Class: String
Overview
Enhance the String class with a XML escaped character version of to_s.
Instance Method Summary collapse
-
#to_xs ⇒ Object
XML escaped version of to_s.
Instance Method Details
#to_xs ⇒ Object
XML escaped version of to_s
110 111 112 113 114 |
# File 'lib/builder/xchar.rb', line 110 def to_xs unpack('U*').map {|n| n.xchr}.join # ASCII, UTF-8 rescue unpack('C*').map {|n| n.xchr}.join # ISO-8859-1, WIN-1252 end |