From ba7a7f82dfce1c067d4ed53681294672dfc0292e Mon Sep 17 00:00:00 2001 From: Syphax Bouazzouni Date: Thu, 17 Nov 2022 17:44:26 +0100 Subject: [PATCH] test if hashed_obj.respond_to?(:collection) before calling it --- lib/ontologies_linked_data/serializers/json.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ontologies_linked_data/serializers/json.rb b/lib/ontologies_linked_data/serializers/json.rb index 59f54a92..de622944 100644 --- a/lib/ontologies_linked_data/serializers/json.rb +++ b/lib/ontologies_linked_data/serializers/json.rb @@ -51,7 +51,7 @@ def self.type(current_cls, hashed_obj) proc = hashed_obj end - collection = hashed_obj.collection + collection = hashed_obj.respond_to?(:collection) ? hashed_obj.collection : nil if collection proc.type_uri(collection).to_s else