Class: Etheruby::Encoders::Bytes

Inherits:
Base
  • Object
show all
Defined in:
lib/etheruby/encoders/bytes.rb

Instance Attribute Summary

Attributes inherited from Base

#data

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Etheruby::Encoders::Base

Instance Method Details

#decodeObject



34
35
36
37
# File 'lib/etheruby/encoders/bytes.rb', line 34

def decode
  size = Uint.new(data[0..63]).decode[0]
  return Byte.new(size,data[64..data.length]).decode[0], determinate_closest_padding(size+32)
end

#encodeObject



30
31
32
# File 'lib/etheruby/encoders/bytes.rb', line 30

def encode
  Uint.new(data.length).encode + Byte.new(data.length, data).encode
end