instance method
objparse
Ruby on Rails 2.3.18
Since v2.3.18 Last seen in v3.0.20Available in: v2.3.18 v3.0.20
Signature
objparse(ts)
Parses an “object” in the sense of RFC 4627. Returns the parsed value and any trailing tokens.
Parameters
-
tsreq
Source
# File activesupport/lib/active_support/json/backends/okjson.rb, line 94
def objparse(ts)
ts = eat('{', ts)
obj = {}
if ts[0][0] == '}'
return obj, ts[1..-1]
end
k, v, ts = pairparse(ts)
obj[k] = v
if ts[0][0] == '}'
return obj, ts[1..-1]
end
loop do
ts = eat(',', ts)
k, v, ts = pairparse(ts)
obj[k] = v
if ts[0][0] == '}'
return obj, ts[1..-1]
end
end
end
Defined in activesupport/lib/active_support/json/backends/okjson.rb line 94
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::OkJson