module Eth::Rlp::Sedes

def infer(obj)

Raises:
  • (TypeError) - if no appropriate sedes could be found.

Parameters:
  • obj (Object) -- the Ruby object for which to find a sedes object.
def infer(obj)
  return obj.class if is_sedes? obj.class
  return big_endian_int if obj.is_a?(Integer) && obj >= 0
  return binary if Binary.valid_type? obj
  return List.new(elements: obj.map { |item| infer item }) if Util.is_list? obj
  raise TypeError, "Did not find sedes handling type #{obj.class.name}"
end