From 795a9b3689fde262d6f2b0a108abfff0dba8691b Mon Sep 17 00:00:00 2001 From: David Harsha Date: Fri, 13 Oct 2023 15:23:45 -0700 Subject: [PATCH] Simplify `result` method still ugly tho --- lib/json_schemer/output.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/json_schemer/output.rb b/lib/json_schemer/output.rb index 3d5c92c8..9ca0c13e 100644 --- a/lib/json_schemer/output.rb +++ b/lib/json_schemer/output.rb @@ -8,11 +8,7 @@ module Output private def result(instance, instance_location, keyword_location, valid, nested = nil, type: nil, annotation: nil, details: nil, ignore_nested: false) - if valid - Result.new(self, instance, instance_location, keyword_location, valid, nested, type, annotation, details, ignore_nested, 'annotations') - else - Result.new(self, instance, instance_location, keyword_location, valid, nested, type, annotation, details, ignore_nested, 'errors') - end + Result.new(self, instance, instance_location, keyword_location, valid, nested, type, annotation, details, ignore_nested, valid ? 'annotations' : 'errors') end def escaped_keyword