Class: Prism::Relocation::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/prism/relocation.rb

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.



153
154
155
# File 'lib/prism/relocation.rb', line 153

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

The value that will need to be reparsed.



150
151
152
# File 'lib/prism/relocation.rb', line 150

def value
  @value
end

Instance Method Details

#code_units_cache(encoding) ⇒ Object

Create a code units cache for the given encoding.



163
164
165
# File 'lib/prism/relocation.rb', line 163

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

#resultObject

Reparse the value and return the parse result.

Raises:

  • (NotImplementedError)


158
159
160
# File 'lib/prism/relocation.rb', line 158

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