Class: Prism::Relocation::CodeUnitColumnsField
- Inherits:
-
Object
- Object
- Prism::Relocation::CodeUnitColumnsField
- Defined in:
- lib/prism/relocation.rb,
sig/generated/prism/relocation.rbs
Overview
A field representing the start and end code unit columns for a specific encoding.
Instance Attribute Summary collapse
-
#encoding ⇒ Encoding
readonly
The associated encoding for the code units.
-
#repository ⇒ Repository
readonly
The repository object that is used for lazily creating a code units cache.
Instance Method Summary collapse
-
#fields(value) ⇒ entry_values
Fetches the start and end code units column of a value for a particular encoding.
-
#initialize(repository, encoding) ⇒ CodeUnitColumnsField
constructor
Initialize a new field with the associated repository and encoding.
Constructor Details
#initialize(repository, encoding) ⇒ CodeUnitColumnsField
Initialize a new field with the associated repository and encoding.
: (Repository repository, Encoding encoding) -> void
380 381 382 383 384 |
# File 'lib/prism/relocation.rb', line 380 def initialize(repository, encoding) @repository = repository @encoding = encoding @cache = nil end |
Instance Attribute Details
#encoding ⇒ Encoding (readonly)
The associated encoding for the code units.
373 374 375 |
# File 'lib/prism/relocation.rb', line 373 def encoding @encoding end |
#repository ⇒ Repository (readonly)
The repository object that is used for lazily creating a code units cache.
370 371 372 |
# File 'lib/prism/relocation.rb', line 370 def repository @repository end |
Instance Method Details
#fields(value) ⇒ entry_values
Fetches the start and end code units column of a value for a particular encoding.
: (_Value value) -> entry_values
390 391 392 393 394 395 |
# File 'lib/prism/relocation.rb', line 390 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 |