class XmlMatchers::Assertion

Attributes

xml_schema[R]

Public Class Methods

for(schema_content) click to toggle source
# File lib/xml_matchers.rb, line 8
def self.for(schema_content)
  new(xml_schema: Nokogiri::XML::Schema(schema_content.to_s))
rescue Nokogiri::XML::SyntaxError
  raise InvalidSchemaError
end
new(xml_schema:) click to toggle source
# File lib/xml_matchers.rb, line 14
def initialize(xml_schema:)
  @xml_schema = xml_schema
end

Public Instance Methods

valid?(xml_content) click to toggle source
# File lib/xml_matchers.rb, line 18
def valid?(xml_content)
  xml_document = Nokogiri::XML(xml_content)
  xml_schema.valid?(xml_document)
end