| Class | EimXML::PCString |
| In: |
lib/eim_xml.rb
|
| Parent: | Object |
| encoded_string | -> | to_s |
| encoded_string | [R] | |
| src | [R] |
# File lib/eim_xml.rb, line 31
31: def self.[](obj)
32: obj.is_a?(PCString) ? obj : PCString.new(obj)
33: end
# File lib/eim_xml.rb, line 14
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
# File lib/eim_xml.rb, line 35
35: def initialize(s, encoded=false)
36: @src = s
37: @encoded_string = encoded ? s : PCString.encode(s)
38: end
# File lib/eim_xml.rb, line 40
40: def ==(other)
41: other.is_a?(PCString) ? @encoded_string==other.encoded_string : self==PCString.new(other)
42: end