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 prism/serialize.rb, line 28
def self.load(input, serialized)
  input = input.dup
  source = Source.for(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 prism/serialize.rb, line 40
def self.load_tokens(source, serialized)
  Loader.new(source, serialized).load_tokens_result
end