opal/corelib/marshal/read_buffer.rb
# Reads and returns a Struct from an input stream
#
# @example
#   Point = Struct.new(:x, :y)
#   Point.new(100, 200)
# is encoded as
#   'S', :Point, {:x => 100, :y => 200}
#
Reads and returns a Struct from an input stream
Reads and returns a Struct from an input stream
def read_struct
      klass_name = read(cache: false)
      klass = safe_const_get(klass_name)
      attributes = read_hash(cache: false)
      args = attributes.values_at(*klass.members)
      result = klass.new(*args)
      @object_cache << result
      result
    end
def read_struct klass_name = read ( cache : false ) klass = safe_const_get ( klass_name ) attributes = read_hash ( cache : false ) args = attributes . values_at ( * klass . members ) result = klass . new ( * args ) @object_cache << result result end
Reads and returns a Struct from an input stream
Reads and returns a Struct from an input stream
example
None