lib/base_validator.rb in cqm-validators-0.1.1 vs lib/base_validator.rb in cqm-validators-1.0.1.0

- old
+ new

@@ -1,22 +1,22 @@ +# frozen_string_literal: true + module CqmValidators - module BaseValidator - - def build_error(msg, loc, file_name) - ValidationError.new(message: msg, location: loc, file_name: file_name, validator: @name) - end - - def get_document(input) - doc = case input - when File - input.read - when Nokogiri::XML::Document - return input - else - input - end - Nokogiri::XML(doc.to_s) { |conf| conf.strict.nonet.noblanks } #grumble, grumble nokogiri java @SS - end - end - + module BaseValidator + def build_error(msg, loc, file_name) + ValidationError.new(message: msg, location: loc, file_name: file_name, validator: @name) + end + + def get_document(input) + doc = case input + when File + input.rewind + input.read + when Nokogiri::XML::Document + return input + else + input + end + Nokogiri::XML(doc.to_s) { |conf| conf.strict.nonet.noblanks } # grumble, grumble nokogiri java @SS + end + end end - \ No newline at end of file