instance method textparse

Ruby on Rails 2.3.18

Since v2.3.18 Last seen in v3.0.20

Available in: v2.3.18 v3.0.20

Signature

textparse(ts)

Parses a “json text” in the sense of RFC 4627. Returns the parsed value and any trailing tokens. Note: this is almost the same as valparse, except that it does not accept atomic values.

Parameters

ts req
Source
# File activesupport/lib/active_support/json/backends/okjson.rb, line 59
    def textparse(ts)
      if ts.length < 0
        raise Error, 'empty'
      end

      typ, _, val = ts[0]
      case typ
      when '{' then objparse(ts)
      when '[' then arrparse(ts)
      else
        raise Error, "unexpected #{val.inspect}"
      end
    end

Defined in activesupport/lib/active_support/json/backends/okjson.rb line 59 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::OkJson

Type at least 2 characters to search.

↑↓ navigate · open · esc close