Module: Klay::Rlp::Encoder

Extended by:
Encoder
Included in:
Encoder
Defined in:
lib/klay/rlp/encoder.rb

Overview

Provides an RLP-encoder.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.perform(obj) ⇒ String

Encodes a Ruby object in RLP format.

Parameters:

  • obj (Object)

    a Ruby object.

Returns:

  • (String)

    the RLP encoded item.

Raises:



34
35
36
37
# File 'lib/klay/rlp/encoder.rb', line 34

def perform(obj)
  item = Sedes.infer(obj).serialize(obj)
  result = encode_raw item
end

Instance Method Details

#perform(obj) ⇒ String

Encodes a Ruby object in RLP format.

Parameters:

  • obj (Object)

    a Ruby object.

Returns:

  • (String)

    the RLP encoded item.

Raises:



34
35
36
37
# File 'lib/klay/rlp/encoder.rb', line 34

def perform(obj)
  item = Sedes.infer(obj).serialize(obj)
  result = encode_raw item
end