Commit cc6302d
Changed files (5)
lib
saml
lib/saml/kit/assertion.rb
@@ -83,8 +83,12 @@ module Saml
@node.present?
end
- def to_xml(pretty: false)
- pretty ? @node.to_xml(indent: 2) : @node.to_s
+ def to_xml(pretty: nil)
+ pretty ? @node.to_xml(indent: 2) : to_s
+ end
+
+ def to_s
+ @node.to_s
end
private
lib/saml/kit/document.rb
@@ -65,8 +65,8 @@ module Saml
# Returns the SAML document as an XML string.
#
# @param pretty [Boolean] formats the xml or returns the raw xml.
- def to_xml(pretty: false)
- pretty ? to_nokogiri.to_xml(indent: 2) : content
+ def to_xml(pretty: nil)
+ pretty ? to_nokogiri.to_xml(indent: 2) : to_s
end
# Returns the SAML document as an XHTML string.
@@ -77,7 +77,7 @@ module Saml
# @!visibility private
def to_nokogiri
- @to_nokogiri ||= Nokogiri::XML(content)
+ @to_nokogiri ||= Nokogiri::XML(to_s)
end
# @!visibility private
@@ -91,7 +91,7 @@ module Saml
end
def to_s
- to_xml
+ content
end
class << self
lib/saml/kit/metadata.rb
@@ -153,14 +153,14 @@ module Saml
# Returns the XML document as a String.
#
- # @param pretty [Symbol] true to return a human friendly version of the XML.
- def to_xml(pretty: false)
- pretty ? to_nokogiri.to_xml(indent: 2) : @xml
+ # @param pretty [Boolean] true to return a human friendly version of the XML.
+ def to_xml(pretty: nil)
+ pretty ? to_nokogiri.to_xml(indent: 2) : to_s
end
# Returns the XML document as a [String].
def to_s
- to_xml
+ @xml
end
# Verifies the signature and data using the signing certificates.
lib/saml/kit/signature.rb
@@ -72,8 +72,12 @@ module Saml
node.present?
end
- def to_xml(pretty: false)
- pretty ? node.to_xml(indent: 2) : node.to_s
+ def to_xml(pretty: nil)
+ pretty ? node.to_xml(indent: 2) : to_s
+ end
+
+ def to_s
+ node.to_s
end
private
.reek
@@ -52,12 +52,8 @@ Attribute:
- Saml::Kit::Document#registry
BooleanParameter:
exclude:
- - Saml::Kit::Assertion#to_xml
- Saml::Kit::DefaultRegistry#register_url
- Saml::Kit::DefaultRegistry::HttpApi#initialize
- - Saml::Kit::Document#to_xml
- - Saml::Kit::Metadata#to_xml
- - Saml::Kit::Signature#to_xml
ControlParameter:
exclude:
- Saml::Kit::Assertion#to_xml