class Sorbet::Eraser::Parser::MultiByteString

Represents a line in the source. If this class is being used, it means that there are characters in the string that are multi-byte, so we will build up an array of indices, such that array will be equal to the index of the character within the string.

Public Class Methods

new(start, line) click to toggle source
# File lib/sorbet/eraser/parser.rb, line 27
def initialize(start, line)
  @indices = []

  line
    .each_char
    .with_index(start) do |char, index|
      char.bytesize.times { @indices << index }
    end
end

Public Instance Methods

[](byteindex) click to toggle source
# File lib/sorbet/eraser/parser.rb, line 37
def [](byteindex)
  @indices[byteindex]
end