lib/schema_validator.rb in cqm-validators-0.1.1 vs lib/schema_validator.rb in cqm-validators-1.0.1.0
- old
+ new
@@ -1,23 +1,24 @@
+# frozen_string_literal: true
+
module CqmValidators
- module Schema
- class Validator
- include BaseValidator
-
- def initialize(name, schema_file)
- @name = name
- @schema_file = schema_file
- @xsd = Nokogiri::XML::Schema(File.new(@schema_file))
- end
-
- # Validate the document against the configured schema
- def validate(document,data={})
- @xsd.errors.clear
- doc = get_document(document)
- @xsd.validate(doc).map do |error|
- build_error(error.message, "/", data[:file_name])
- end
- end
+ module Schema
+ class Validator
+ include BaseValidator
+
+ def initialize(name, schema_file)
+ @name = name
+ @schema_file = schema_file
+ @xsd = Nokogiri::XML::Schema(File.new(@schema_file))
+ end
+
+ # Validate the document against the configured schema
+ def validate(document, data = {})
+ @xsd.errors.clear
+ doc = get_document(document)
+ @xsd.validate(doc).map do |error|
+ build_error(error.message, '/', data[:file_name])
end
end
+ end
+ end
end
-
\ No newline at end of file