Class: Prism::Relocation::CodeUnitOffsetsField
- Inherits:
-
Object
- Object
- Prism::Relocation::CodeUnitOffsetsField
- Defined in:
- lib/prism/relocation.rb
Overview
A field representing the start and end code unit offsets.
Instance Attribute Summary collapse
-
#encoding ⇒ Object
readonly
The associated encoding for the code units.
-
#repository ⇒ Object
readonly
A pointer to 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 offset of a value for a particular encoding.
-
#initialize(repository, encoding) ⇒ CodeUnitOffsetsField
constructor
Initialize a new field with the associated repository and encoding.
Constructor Details
#initialize(repository, encoding) ⇒ CodeUnitOffsetsField
Initialize a new field with the associated repository and encoding.
237 238 239 240 241 |
# File 'lib/prism/relocation.rb', line 237 def initialize(repository, encoding) @repository = repository @encoding = encoding @cache = nil end |
Instance Attribute Details
#encoding ⇒ Object (readonly)
The associated encoding for the code units.
234 235 236 |
# File 'lib/prism/relocation.rb', line 234 def encoding @encoding end |
#repository ⇒ Object (readonly)
A pointer to the repository object that is used for lazily creating a code units cache.
231 232 233 |
# File 'lib/prism/relocation.rb', line 231 def repository @repository end |
Instance Method Details
#fields(value) ⇒ Object
Fetches the start and end code units offset of a value for a particular encoding.
245 246 247 248 249 250 |
# File 'lib/prism/relocation.rb', line 245 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 |