123456789_123456789_123456789_123456789_123456789_

Class: Prism::Serialize::Loader::FastStringIO

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: lib/prism/serialize.rb

Overview

StringIO is synchronized and that adds a high overhead on TruffleRuby.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(string) ⇒ FastStringIO

[ GitHub ]

  
# File 'lib/prism/serialize.rb', line 50

def initialize(string)
  @string = string
  @pos = 0
end

Instance Attribute Details

#eof? ⇒ Boolean (readonly)

[ GitHub ]

  
# File 'lib/prism/serialize.rb', line 67

def eof?
  @pos >= @string.bytesize
end

#pos (rw)

[ GitHub ]

  
# File 'lib/prism/serialize.rb', line 48

attr_accessor :pos

Instance Method Details

#getbyte

[ GitHub ]

  
# File 'lib/prism/serialize.rb', line 55

def getbyte
  byte = @string.getbyte(@pos)
  @pos += 1
  byte
end

#read(n)

[ GitHub ]

  
# File 'lib/prism/serialize.rb', line 61

def read(n)
  slice = @string.byteslice(@pos, n)
  @pos += n
  slice
end