Sha256: 01b449a5df4b1df25ff7c9c30caed4b4f7f980b6ad32303eb25d1b3e06b29143
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
class Symbol include Comparable def <=>(other) return unless other.kind_of?(Symbol) to_s <=> other.to_s 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) const_defined?(name, false) end end end class Struct alias_method :__class__, :class end unless Struct.instance_methods.include?(:__class__) module CSL module_function if RUBY_VERSION < '1.9' XML_ENTITY_SUBSTITUTION = Hash[*%w{ & & < < > > ' ' " " }].freeze def encode_xml_text(string) string.gsub(/[&<>]/) { |match| XML_ENTITY_SUBSTITUTION[match] } end def encode_xml_attr(string) string.gsub(/[&<>'"]/) { |match| XML_ENTITY_SUBSTITUTION[match] }.inspect end else def encode_xml_text(string) string.encode(:xml => :text) end def encode_xml_attr(string) string.encode(:xml => :attr) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
csl-1.0.2 | lib/csl/compatibility.rb |
csl-1.0.1 | lib/csl/compatibility.rb |