class Prism::Relocation::CodeUnitOffsetsField

A field representing the start and end code unit offsets.

def cache

Lazily create a code units cache for the associated encoding.
def cache
  @cache ||= repository.code_units_cache(encoding)
end

def fields(value)

encoding.
Fetches the start and end code units offset of a value for a particular
def fields(value)
  {
    start_code_units_offset: value.cached_start_code_units_offset(cache),
    end_code_units_offset: value.cached_end_code_units_offset(cache)
  }
end

def initialize(repository, encoding)

Initialize a new field with the associated repository and encoding.
def initialize(repository, encoding)
  @repository = repository
  @encoding = encoding
  @cache = nil
end