module T::Props::Serializable

def deserialize(hash, strict=false)

Returns:
  • (void) -

Parameters:
  • strict (T::Boolean) -- (false) If true, raise an exception if
  • hash (Hash) -- The hash to take property
def deserialize(hash, strict=false)
  begin
    hash_keys_matching_props = __t_props_generated_deserialize(hash)
  rescue => e
    msg = self.class.decorator.message_with_generated_source_context(
      e,
      :__t_props_generated_deserialize,
      :generate_deserialize_source
    )
    if msg
      begin
        raise e.class.new(msg)
      rescue ArgumentError
        raise TypeError.new(msg)
      end
    else
      raise
    end
  end
  if hash.size > hash_keys_matching_props
    serialized_forms = self.class.decorator.prop_by_serialized_forms
    extra = hash.reject {|k, _| serialized_forms.key?(k)}
    # `extra` could still be empty here if the input matches a `dont_store` prop;
    # historically, we just ignore those
    if !extra.empty?
      if strict
        raise "Unknown properties for #{self.class.name}: #{extra.keys.inspect}"
      else
        @_extra_props = extra
      end
    end
  end
end