instance method lex

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

lex(s)

Scans s and returns a list of json tokens, excluding white space (as defined in RFC 4627).

Parameters

s req
Source
# File activesupport/lib/active_support/json/backends/okjson.rb, line 175
    def lex(s)
      ts = []
      while s.length > 0
        typ, lexeme, val = tok(s)
        if typ == nil
          raise Error, "invalid character at #{s[0,10].inspect}"
        end
        if typ != :space
          ts << [typ, lexeme, val]
        end
        s = s[lexeme.length..-1]
      end
      ts
    end

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

Defined in ActiveSupport::OkJson

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close