class YARP::Serialize::Loader
def load
def load raise "Invalid serialization" if io.read(4) != "YARP" raise "Invalid serialization" if io.read(3).unpack("C3") != [MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION] @encoding = Encoding.find(io.read(load_varint)) @input = input.force_encoding(@encoding).freeze comments = load_varint.times.map { Comment.new(Comment::TYPES.fetch(io.getbyte), load_location) } errors = load_varint.times.map { ParseError.new(load_string, load_location) } warnings = load_varint.times.map { ParseWarning.new(load_string, load_location) } @constant_pool_offset = io.read(4).unpack1("L") @constant_pool = Array.new(load_varint, nil) ast = load_node YARP::ParseResult.new(ast, comments, errors, warnings, @source) end