Don't unpack Fixnum.

This commit is contained in:
bootstraponline
2012-08-22 17:40:53 -06:00
parent 55df7bb9c4
commit 1757242382
+3 -2
View File
@@ -40,8 +40,9 @@ end
# define charCodeAt on String # define charCodeAt on String
class String class String
def charCodeAt(k) def charCodeAt(k)
# 'str'.ord is broken on 1.8 # use unpack instead of ord for 1.8
return self[k].unpack('U')[0] c = self[k]
return c.respond_to?(:unpack) ? c.unpack('U')[0] : c.ord
end end
end end