From 9ee69fecd5cf2bc4468116574ace170bcfa938cb Mon Sep 17 00:00:00 2001 From: Kimmo Lehto Date: Thu, 20 Dec 2018 13:39:52 +0200 Subject: [PATCH] Rubocop --- lib/yaml/safe_load_stream.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/yaml/safe_load_stream.rb b/lib/yaml/safe_load_stream.rb index e0d9870..dce1775 100644 --- a/lib/yaml/safe_load_stream.rb +++ b/lib/yaml/safe_load_stream.rb @@ -28,14 +28,15 @@ module YAMLSafeLoadStream doc_num += 1 if obj.is_a?(Psych::Nodes::Document) if obj.respond_to?(:tag) - if tag = obj.tag + tag = obj.tag + unless tag.nil? unless tag.to_s.start_with?('tag:yaml.org,') message = "tag #{tag} encountered " - if obj.respond_to?(:start_line) - message += "on line #{obj.start_line} column #{obj.start_column} of document #{doc_num}" - else - message += "in document #{doc_num}" - end + message += if obj.respond_to?(:start_line) + "on line #{obj.start_line} column #{obj.start_column} of document #{doc_num}" + else + "in document #{doc_num}" + end message += " in file #{filename}" if filename raise Psych::DisallowedClass, message end