class Array
Public Instance Methods
from_json(lexer)
click to toggle source
This method will parse a JSON
array from the passed lexer object. It takes a lexer object which is about to read a JSON
array. It raises a runtime error otherwise. It returns the original JSON
array. This method is not intended to be used directly.
Parameters¶ ↑
lexer
-
Lexer object to use
# File lib/json/objects.rb, line 122 def from_json(lexer) raise "A JSON Array must begin with '['" if (lexer.nextclean != "[") return (self) if lexer.nextclean == ']' lexer.back loop { self << lexer.nextvalue case lexer.nextclean when ',' return(self) if (lexer.nextclean == ']') lexer.back when ']' return(self) else raise "Expected a ',' or ']'" end } end
to_json()
click to toggle source