mirror of
https://gitea.invidious.io/iv-org/protodec.git
synced 2024-08-15 00:43:18 +00:00
cast_json: enforce param type at compile time
This commit is contained in:
parent
11813ae363
commit
c6cede69e6
1 changed files with 1 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue