Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Prism::ASCIISource#code_units_offset
code_units_offset(byte_offset, encoding)
lib/prism/parse_result.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/prism/parse_result.rb, line 253
def code_units_offset(byte_offset, encoding)
byte_offset
end
Returns the offset from the start of the file for the given byte offset counting in code units for the given encoding.
This method is tested with UTF-8, UTF-16, and UTF-32. If there is the concept of code units that differs from the number of characters in other encodings, it is not captured here.