lib/raven/okjson.rb in sentry-raven-0.15.2 vs lib/raven/okjson.rb in sentry-raven-0.15.3
- old
+ new
@@ -219,11 +219,11 @@
# excluding white space (as defined in RFC 4627).
def lex(s)
ts = []
while s.length > 0
typ, lexeme, val = tok(s)
- if typ == nil
+ if typ.nil?
raise Error, "invalid character at #{s[0,10].inspect}"
end
if typ != :space
ts << [typ, lexeme, val]
end
@@ -287,11 +287,11 @@
end
def strtok(s)
m = /"([^"\\]|\\["\/\\bfnrt]|\\u[0-9a-fA-F]{4})*"/.match(s)
- if ! m
+ unless m
raise Error, "invalid string literal at #{abbrev(s)}"
end
[:str, m[0], unquote(m[0])]
end
@@ -446,9 +446,10 @@
def keyenc(k)
case k
when String then strenc(k)
when Symbol then strenc(k.to_s)
+ when Fixnum then strenc(k.to_s)
else
raise Error, "Hash key is not a string: #{k.inspect}"
end
end