Class: SAML::Core::Document
- Inherits:
-
REXML::Document
- Object
- REXML::Document
- SAML::Core::Document
- Defined in:
- lib/saml/core/document.rb
Instance Method Summary collapse
-
#add_element(name, attrs = {}) ⇒ Object
See REXML::Document#add_element.
-
#initialize(*args) ⇒ Document
constructor
A new instance of Document.
Constructor Details
#initialize(*args) ⇒ Document
Returns a new instance of Document.
8 9 10 11 |
# File 'lib/saml/core/document.rb', line 8 def initialize(*args) super(*args) XMLNamespaces.each {|k,v| add_namespace(k, v)} end |
Instance Method Details
#add_element(name, attrs = {}) ⇒ Object
See REXML::Document#add_element
Makes sure that all namespaces are added to the root element.
16 17 18 19 20 21 |
# File 'lib/saml/core/document.rb', line 16 def add_element(name, attrs={}) ns = XMLNamespaces.map {|k, v| ["xmlns:#{k}", v]} ns = Hash[*ns.flatten] attrs.merge!(ns) super(name, attrs) end |