Class: Etheruby::Encoders::Bool

Inherits:
Base
  • Object
show all
Defined in:
lib/etheruby/encoders/bool.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



11
12
13
# File 'lib/etheruby/encoders/bool.rb', line 11

def decode
  return Uint.new(data).decode[0] == 1, 32
end

#encodeObject



7
8
9
# File 'lib/etheruby/encoders/bool.rb', line 7

def encode
  Uint.new(data ? 1 : 0).encode
end