Class: Prism::Relocation::CodeUnitColumnsField
- Inherits:
-
Object
- Object
- Prism::Relocation::CodeUnitColumnsField
- Defined in:
- lib/prism/relocation.rb
Overview
A field representing the start and end code unit columns for a specific encoding.
Instance Attribute Summary collapse
-
#encoding ⇒ Object
readonly
The associated encoding for the code units.
-
#repository ⇒ Object
readonly
The repository object that is used for lazily creating a code units cache.
Instance Method Summary collapse
-
#fields(value) ⇒ Object
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.
290 291 292 293 294 |
# File 'lib/prism/relocation.rb', line 290 def initialize(repository, encoding) @repository = repository @encoding = encoding @cache = nil end |
Instance Attribute Details
#encoding ⇒ Object (readonly)
The associated encoding for the code units.
287 288 289 |
# File 'lib/prism/relocation.rb', line 287 def encoding @encoding end |
#repository ⇒ Object (readonly)
The repository object that is used for lazily creating a code units cache.
284 285 286 |
# File 'lib/prism/relocation.rb', line 284 def repository @repository end |
Instance Method Details
#fields(value) ⇒ Object
Fetches the start and end code units column of a value for a particular encoding.
298 299 300 301 302 303 |
# File 'lib/prism/relocation.rb', line 298 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 |