class EimXML::PCString
Attributes
encoded_string[R]
src[R]
to_s[R]
Public Class Methods
[](obj)
click to toggle source
# File lib/eim_xml.rb 31 def self.[](obj) 32 obj.is_a?(PCString) ? obj : PCString.new(obj) 33 end
encode(s)
click to toggle source
# File lib/eim_xml.rb 14 def self.encode(s) 15 s.to_s.gsub(/[&\"\'<>]/) do |m| 16 case m 17 when "&" 18 "&" 19 when '"' 20 """ 21 when "'" 22 "'" 23 when "<" 24 "<" 25 when ">" 26 ">" 27 end 28 end 29 end
new(s, encoded=false)
click to toggle source
# File lib/eim_xml.rb 35 def initialize(s, encoded=false) 36 @src = s 37 @encoded_string = encoded ? s : PCString.encode(s) 38 end
Public Instance Methods
==(other)
click to toggle source
# File lib/eim_xml.rb 40 def ==(other) 41 other.is_a?(PCString) ? @encoded_string==other.encoded_string : self==PCString.new(other) 42 end
write_to(out="")
click to toggle source
# File lib/eim_xml.rb 44 def write_to(out="") 45 out << encoded_string 46 end