Class: Prism::Relocation::CodeUnitColumnsField
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/prism/relocation.rb |
Overview
A field representing the start and end code unit columns for a specific encoding.
Class Method Summary
-
.new(repository, encoding) ⇒ CodeUnitColumnsField
constructor
Initialize a new field with the associated repository and encoding.
Instance Attribute Summary
-
#encoding
readonly
The associated encoding for the code units.
-
#repository
readonly
The repository object that is used for lazily creating a code units cache.
Instance Method Summary
-
#fields(value)
Fetches the start and end code units column of a value for a particular encoding.
-
#cache
private
Lazily create a code units cache for the associated encoding.
Constructor Details
.new(repository, encoding) ⇒ CodeUnitColumnsField
Initialize a new field with the associated repository and encoding.
# File 'lib/prism/relocation.rb', line 290
def initialize(repository, encoding) @repository = repository @encoding = encoding @cache = nil end
Instance Attribute Details
#encoding (readonly)
The associated encoding for the code units.
# File 'lib/prism/relocation.rb', line 287
attr_reader :encoding
#repository (readonly)
The repository object that is used for lazily creating a code units cache.
# File 'lib/prism/relocation.rb', line 284
attr_reader :repository
Instance Method Details
#cache (private)
Lazily create a code units cache for the associated encoding.
# File 'lib/prism/relocation.rb', line 308
def cache @cache ||= repository.code_units_cache(encoding) end
#fields(value)
Fetches the start and end code units column of a value for a particular encoding.