main
 1# frozen_string_literal: true
 2
 3module Saml
 4  module Kit
 5    # This class represents an invalid SAML
 6    # document that could not be parsed.
 7    # {include:file:spec/saml/kit/invalid_document_spec.rb}
 8    class InvalidDocument < Document
 9      validate do |model|
10        model.errors.add(:base, model.error_message(:invalid))
11      end
12
13      def initialize(xml, *)
14        super(xml, name: 'InvalidDocument')
15      end
16
17      def to_h
18        super
19      rescue StandardError
20        {}
21      end
22    end
23  end
24end