module Prism::Serialize
A module responsible for deserializing parse results.
Constants
- MAJOR_VERSION
The major version of prism that we are expecting to find in the serialized strings.
- MINOR_VERSION
The minor version of prism that we are expecting to find in the serialized strings.
- PATCH_VERSION
The patch version of prism that we are expecting to find in the serialized strings.
- TOKEN_TYPES
The token types that can be indexed by their enum values.
Public Class Methods
load(input, serialized)
click to toggle source
Deserialize the AST represented by the given string into a parse result.
# File lib/prism/serialize.rb, line 37 def self.load(input, serialized) input = input.dup source = Source.new(input) loader = Loader.new(source, serialized) result = loader.load_result input.force_encoding(loader.encoding) result end
load_tokens(source, serialized)
click to toggle source
Deserialize the tokens represented by the given string into a parse result.
# File lib/prism/serialize.rb, line 49 def self.load_tokens(source, serialized) Loader.new(source, serialized).load_tokens_result end