Sha256: 72125dca4cbbc4a5da2436860d732ae4735adb193a5579ac1cc5d3980f24b8a6
Contents?: true
Size: 610 Bytes
Versions: 8
Compression:
Stored size: 610 Bytes
Contents
class XDR::Opaque include XDR::Concerns::ConvertsToXDR include XDR::Concerns::StringConverter singleton_class.send(:alias_method, :[], :new) def initialize(length) @length = length @padding = padding_for length end def read(io) # read and return @length bytes # throw away @padding bytes read_bytes(io, @length).tap{ read_bytes(io, @padding) } end def write(val,io) length = val.bytesize if val.length != @length raise XDR::WriteError, "Value length is #{length}, must be #{@length}" end io.write val io.write "\x00" * @padding end end
Version data entries
8 entries across 8 versions & 2 rubygems