# File lib/htmlentities.rb, line 37 def decode(source) return source.to_s.gsub(named_entity_regexp) { (cp = map[$1]) ? [cp].pack('U') : $& }.gsub(/&#([0-9]{1,7});|&#x([0-9a-f]{1,6});/i) { $1 ? [$1.to_i].pack('U') : [$2.to_i(16)].pack('U') } end