Class: Prism::Relocation::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/prism/relocation.rb,
sig/generated/prism/relocation.rbs

Overview

Represents the source of a repository that will be reparsed.

Direct Known Subclasses

SourceFilepath, SourceString

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Source

Initialize the source with the given value.

: (untyped value) -> void

Parameters:

  • value (Object)


209
210
211
# File 'lib/prism/relocation.rb', line 209

def initialize(value)
  @value = value
end

Instance Attribute Details

#value ⇒ Object (readonly)

The value that will need to be reparsed.

Returns:

  • (Object)


204
205
206
# File 'lib/prism/relocation.rb', line 204

def value
  @value
end

Instance Method Details

#code_units_cache(encoding) ⇒ _CodeUnitsCache

Create a code units cache for the given encoding.

: (Encoding encoding) -> _CodeUnitsCache

Parameters:

  • encoding (Encoding)

Returns:



223
224
225
# File 'lib/prism/relocation.rb', line 223

def code_units_cache(encoding)
  result.code_units_cache(encoding)
end

#result ⇒ ParseResult

Reparse the value and return the parse result.

: () -> ParseResult

Returns:



216
217
218
# File 'lib/prism/relocation.rb', line 216

def result
  raise NotImplementedError, "Subclasses must implement #result"
end