cast_json: enforce param type at compile time

This commit is contained in:
Samantaz Fox 2022-12-01 00:07:22 +01:00
parent 11813ae363
commit c6cede69e6

View file

@ -468,9 +468,7 @@ module Protodec
Any.new(raw.clone)
end
def self.cast_json(object)
raise "Invalid type" if !object.is_a?(Hash)
def self.cast_json(object : Hash)
JSON::Any.new(object.transform_values do |value|
case value
when .is_a?(Hash)