Module: Klay::Rlp

Extended by:
Rlp
Included in:
Rlp
Defined in:
lib/klay/rlp.rb,
lib/klay/rlp/sedes.rb,
lib/klay/rlp/decoder.rb,
lib/klay/rlp/encoder.rb,
lib/klay/rlp/sedes/list.rb,
lib/klay/rlp/sedes/binary.rb,
lib/klay/rlp/sedes/big_endian_int.rb

Overview

Provides an recursive-length prefix (RLP) encoder and decoder.

Defined Under Namespace

Modules: Decoder, Encoder, Sedes Classes: Data, DecodingError, DeserializationError, EncodingError, RlpException, SerializationError

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.decode(rlp) ⇒ Object

Performes an Decoder on any RLP-encoded item.

Parameters:

  • rlp (String)

    a packed, RLP-encoded item.

Returns:

  • (Object)

    a decoded ruby object.



59
60
61
# File 'lib/klay/rlp.rb', line 59

def decode(rlp)
  Rlp::Decoder.perform rlp
end

.encode(obj) ⇒ String

Performes an Encoder on any ruby object.

Parameters:

  • obj (Object)

    any ruby object.

Returns:

  • (String)

    a packed, RLP-encoded item.



51
52
53
# File 'lib/klay/rlp.rb', line 51

def encode(obj)
  Rlp::Encoder.perform obj
end

Instance Method Details

#decode(rlp) ⇒ Object

Performes an Decoder on any RLP-encoded item.

Parameters:

  • rlp (String)

    a packed, RLP-encoded item.

Returns:

  • (Object)

    a decoded ruby object.



59
60
61
# File 'lib/klay/rlp.rb', line 59

def decode(rlp)
  Rlp::Decoder.perform rlp
end

#encode(obj) ⇒ String

Performes an Encoder on any ruby object.

Parameters:

  • obj (Object)

    any ruby object.

Returns:

  • (String)

    a packed, RLP-encoded item.



51
52
53
# File 'lib/klay/rlp.rb', line 51

def encode(obj)
  Rlp::Encoder.perform obj
end