class Prism::Relocation::Repository
A repository is a configured collection of fields and a set of entries that knows how to reparse a source and reify the values.
A repository is a configured collection of fields and a set of entries that knows how to reparse a source and reify the values.
Attributes
The entries that have been saved on this repository.
The entries that have been saved on this repository.
Hash[Symbol, _Field]
The fields that have been configured on this repository.
The fields that have been configured on this repository.
Source
The source associated with this repository. This will be either a SourceFilepath (the most common use case) or a SourceString.
The source associated with this repository. This will be either a SourceFilepath (the most common use case) or a SourceString.
Public Class Methods
(Source source) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/relocation.rb, line 428 def initialize(source) @source = source @fields = {} @entries = Hash.new { |hash, node_id| hash[node_id] = {} } end
Initialize a new repository with the given source.
Initialize a new repository with the given source.
: (Source source) -> void
Public Instance Methods
() → self
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/relocation.rb, line 490 def character_columns field(:character_columns, CharacterColumnsField.new) end
Configure the character columns field for this repository and return self.
Configure the character columns field for this repository and return self.
: () -> self
() → self
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/relocation.rb, line 467 def character_offsets field(:character_offsets, CharacterOffsetsField.new) end
Configure the character offsets field for this repository and return self.
Configure the character offsets field for this repository and return self.
: () -> self
(Encoding encoding) → self
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/relocation.rb, line 498 def code_unit_columns(encoding) field(:code_unit_columns, CodeUnitColumnsField.new(self, encoding)) end
Configure the code unit columns field for this repository for a specific encoding and return self.
Configure the code unit columns field for this repository for a specific encoding and return self.
: (Encoding encoding) -> self
(Encoding encoding) → self
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/relocation.rb, line 475 def code_unit_offsets(encoding) field(:code_unit_offsets, CodeUnitOffsetsField.new(self, encoding)) end
Configure the code unit offsets field for this repository for a specific encoding and return self.
Configure the code unit offsets field for this repository for a specific encoding and return self.
: (Encoding encoding) -> self
(Encoding encoding) → _CodeUnitsCache
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/relocation.rb, line 437 def code_units_cache(encoding) source.code_units_cache(encoding) end
Create a code units cache for the given encoding from the source.
Create a code units cache for the given encoding from the source.
: (Encoding encoding) -> _CodeUnitsCache
() → self
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/relocation.rb, line 482 def columns field(:columns, ColumnsField.new) end
Configure the columns field for this repository and return self.
Configure the columns field for this repository and return self.
: () -> self
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/relocation.rbs, line 400
def enter: (Integer node_id, Symbol field_name) -> Entry
() → self
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/relocation.rb, line 444 def filepath raise ConfigurationError, "Can only specify filepath for a filepath source" unless source.is_a?(SourceFilepath) field(:filepath, FilepathField.new(source.value)) end
Configure the filepath field for this repository and return self.
Configure the filepath field for this repository and return self.
: () -> self
() → self
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/relocation.rb, line 452 def lines field(:lines, LinesField.new) end
Configure the lines field for this repository and return self.
Configure the lines field for this repository and return self.
: () -> self
() → self
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/relocation.rb, line 459 def offsets field(:offsets, OffsetsField.new) end
Configure the offsets field for this repository and return self.
Configure the offsets field for this repository and return self.
: () -> self
() → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/relocation.rbs, line 407
def reify!: () -> void
This method is called from the entries in the repository when they need to reify their values. It is internal-only and meant to be called from the various value APIs.
: () -> void