Skip to content

Commit

Permalink
cast_json: enforce param type at compile time
Browse files Browse the repository at this point in the history
  • Loading branch information
SamantazFox committed Nov 30, 2022
1 parent 11813ae commit c6cede6
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/protodec/utils.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c6cede6

Please sign in to comment.