mirror of
https://github.com/iv-org/protodec.git
synced 2024-12-21 21:55:25 -05:00
cast_json: enforce param type at compile time
This commit is contained in:
parent
11813ae363
commit
c6cede69e6
@ -468,9 +468,7 @@ module Protodec
|
|||||||
Any.new(raw.clone)
|
Any.new(raw.clone)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.cast_json(object)
|
def self.cast_json(object : Hash)
|
||||||
raise "Invalid type" if !object.is_a?(Hash)
|
|
||||||
|
|
||||||
JSON::Any.new(object.transform_values do |value|
|
JSON::Any.new(object.transform_values do |value|
|
||||||
case value
|
case value
|
||||||
when .is_a?(Hash)
|
when .is_a?(Hash)
|
||||||
|
Loading…
Reference in New Issue
Block a user