lib/csl/compatibility.rb in csl-1.0.2 vs lib/csl/compatibility.rb in csl-1.1.0

- old
+ new

@@ -1,22 +1,16 @@ +module CSL + module_function -class Symbol - include Comparable - - def <=>(other) - return unless other.kind_of?(Symbol) - to_s <=> other.to_s + def silence_warnings + original_verbosity, $VERBOSE = $VERBOSE, nil + yield + ensure + $VERBOSE = original_verbosity end +end - def match(pattern) - to_s.match(pattern) - end - - alias =~ match - -end unless Symbol.is_a?(Comparable) - class Module if RUBY_VERSION < '1.9' alias const? const_defined? else def const?(name) @@ -49,13 +43,13 @@ XML_ENTITY_SUBSTITUTION[match] }.inspect end else def encode_xml_text(string) - string.encode(:xml => :text) + string.encode(string.encoding, :xml => :text) end def encode_xml_attr(string) - string.encode(:xml => :attr) + string.encode(string.encoding, :xml => :attr) end end end