Commit 2fc8182

mo <mo@mokhan.ca>
2018-03-16 20:32:03
remove duplication.
1 parent c1ca4bd
Changed files (2)
lib/saml/kit/concerns/xml_parseable.rb
@@ -39,6 +39,7 @@ module Saml
 
       # @!visibility private
       def at_xpath(xpath)
+        return unless to_nokogiri
         to_nokogiri.at_xpath(xpath, NAMESPACES)
       end
 
lib/saml/kit/assertion.rb
@@ -8,6 +8,7 @@ module Saml
     class Assertion
       include ActiveModel::Validations
       include Translatable
+      include XmlParseable
       XPATH = [
         '/samlp:Response/saml:Assertion',
         '/samlp:Response/saml:EncryptedAssertion'
@@ -96,10 +97,6 @@ module Saml
         @node.present?
       end
 
-      def to_xml(pretty: nil)
-        pretty ? @node.to_xml(indent: 2) : to_s
-      end
-
       def to_s
         @node.to_s
       end
@@ -148,13 +145,8 @@ module Saml
         errors.add(:base, error_message(:cannot_decrypt)) unless decryptable?
       end
 
-      def at_xpath(xpath)
-        return unless @node
-        @node.at_xpath(xpath, Saml::Kit::Document::NAMESPACES)
-      end
-
-      def search(xpath)
-        @node.search(xpath, Saml::Kit::Document::NAMESPACES)
+      def to_nokogiri
+        @node
       end
     end
   end