class Ruby::Prism::Relocation::CodeUnitColumnsField

A field representing the start and end code unit columns for a specific encoding.

Attributes

The associated encoding for the code units.

The repository object that is used for lazily creating a code units cache.

Public Class Methods

Initialize a new field with the associated repository and encoding.

: (Repository repository, Encoding encoding) -> void

# File lib/ruby/prism/relocation.rb, line 403
def initialize(repository, encoding)
  @repository = repository
  @encoding = encoding
  @cache = nil
end

Public Instance Methods

Fetches the start and end code units column of a value for a particular encoding.

: (_Value value) -> entry_values

# File lib/ruby/prism/relocation.rb, line 413
def fields(value)
  {
    start_code_units_column: value.cached_start_code_units_column(cache),
    end_code_units_column: value.cached_end_code_units_column(cache)
  }
end