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, line 31 def self.[](obj) obj.is_a?(PCString) ? obj : PCString.new(obj) end
encode(s)
click to toggle source
# File lib/eim_xml.rb, line 14 def self.encode(s) s.to_s.gsub(/[&\"\<>]/) do |m| case m when "&" "&" when '"' """ when "'" "'" when "<" "<" when ">" ">" end end end
new(s, encoded=false)
click to toggle source
# File lib/eim_xml.rb, line 35 def initialize(s, encoded=false) @src = s @encoded_string = encoded ? s : PCString.encode(s) end
Public Instance Methods
==(other)
click to toggle source
# File lib/eim_xml.rb, line 40 def ==(other) other.is_a?(PCString) ? @encoded_string==other.encoded_string : self==PCString.new(other) end
write_to(out="")
click to toggle source
# File lib/eim_xml.rb, line 44 def write_to(out="") out << encoded_string end