module Prism::Relocation
Prism parses deterministically for the same input. This provides a nice property that is exposed through the #node_id API on nodes. Effectively this means that for the same input, these values will remain consistent every time the source is parsed. This means we can reparse the source same with a
#node_id value and find the exact same node again.
The Relocation module provides an API around this property. It allows you to “save” nodes and locations using a minimal amount of memory (just the node_id and a field identifier) and then reify them later.
Prism parses deterministically for the same input. This provides a nice property that is exposed through the #node_id API on nodes. Effectively this means that for the same input, these values will remain consistent every time the source is parsed. This means we can reparse the source same with a
#node_id value and find the exact same node again.
The Relocation module provides an API around this property. It allows you to “save” nodes and locations using a minimal amount of memory (just the node_id and a field identifier) and then reify them later.
Public Class Methods
(String value) → Repository
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/relocation.rb, line 556 def self.filepath(value) Repository.new(SourceFilepath.new(value)) end
Create a new repository for the given filepath.
Create a new repository for the given filepath.
: (String value) -> Repository
(String value) → Repository
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/relocation.rb, line 563 def self.string(value) Repository.new(SourceString.new(value)) end
Create a new repository for the given string.
Create a new repository for the given string.
: (String value) -> Repository