lib/codec.rb in scale_rb-0.3.5 vs lib/codec.rb in scale_rb-0.4.0
- old
+ new
@@ -402,9 +402,11 @@
bytes = value._to_bytes._flip
[(((bytes.length - 4) << 2) + 3)] + bytes
end
def encode_uint(type, value)
+ raise InvalidValueError, "type: #{type}, value: #{value.inspect}" unless value.instance_of?(Integer)
+
bit_length = type[1..].to_i
value._to_bytes(bit_length)._flip
end
def encode_option(type, value, registry = {})