Class: Etheruby::Encoders::Ufixed
Instance Attribute Summary
Attributes inherited from FixedBase
#size_d, #size_i
Attributes inherited from Base
#data
Instance Method Summary
collapse
Methods inherited from FixedBase
#initialize
Methods inherited from Base
#initialize
Instance Method Details
#decode ⇒ Object
70
71
72
73
74
|
# File 'lib/etheruby/encoders/fixed.rb', line 70
def decode
@data = data[0..63]
return Uint.new(data[0..(size_i/4)-1]).decode[0] +
decode_decimal_representation(data[(size_i / 4)..data.length]), 32
end
|
#encode ⇒ Object
65
66
67
68
|
# File 'lib/etheruby/encoders/fixed.rb', line 65
def encode
raise InvalidFormatForDataError.new("Unsigned fixed #{data} < 0") if data < 0
Fixed.new(size_i, size_d, data).encode
end
|