Sha256: e5630081807090d581d2f31e126eaf32620ba108a2c5c8db4f20b52371bee4b6

Contents?: true

Size: 336 Bytes

Versions: 11

Compression:

Stored size: 336 Bytes

Contents

module XDR::UnsignedInt
  extend XDR::Concerns::ConvertsToXDR
  extend XDR::Concerns::IntegerConverter

  def self.write(val, io)
    raise XDR::WriteError, "val is not Integer" unless val.is_a?(Integer)
    # TODO: check bounds
    io.write [val].pack("L>")
  end

  def self.read(io)
    read_bytes(io, 4).unpack("L>").first
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
payshares-xdr-0.0.2 lib/xdr/unsigned_int.rb
xdr-3.0.2 lib/xdr/unsigned_int.rb
xdr-3.0.1 lib/xdr/unsigned_int.rb
xdr-3.0.0 lib/xdr/unsigned_int.rb
xdr-2.0.0 lib/xdr/unsigned_int.rb
xdr-1.0.0 lib/xdr/unsigned_int.rb
xdr-0.1.0 lib/xdr/unsigned_int.rb
xdr-0.0.4 lib/xdr/unsigned_int.rb
xdr-0.0.3 lib/xdr/unsigned_int.rb
xdr-0.0.2 lib/xdr/unsigned_int.rb
xdr-0.0.1 lib/xdr/unsigned_int.rb