Class: SAML2::Base
- Inherits:
-
Object
show all
- Defined in:
- lib/saml2/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.from_xml(node) ⇒ Object
5
6
7
8
|
# File 'lib/saml2/base.rb', line 5
def self.from_xml(node)
return nil unless node
new.from_xml(node)
end
|
.load_object_array(node, element, klass) ⇒ Object
34
35
36
37
38
39
40
41
42
|
# File 'lib/saml2/base.rb', line 34
def self.load_object_array(node, element, klass)
node.xpath(element, Namespaces::ALL).map do |node|
if klass.is_a?(Hash)
klass[node.name].from_xml(node)
else
klass.from_xml(node)
end
end
end
|
.load_string_array(node, element) ⇒ Object
28
29
30
31
32
|
# File 'lib/saml2/base.rb', line 28
def self.load_string_array(node, element)
node.xpath(element, Namespaces::ALL).map do |node|
node.content && node.content.strip
end
end
|
.lookup_qname(qname, namespaces) ⇒ Object
44
45
46
47
|
# File 'lib/saml2/base.rb', line 44
def self.lookup_qname(qname, namespaces)
prefix, local_name = split_qname(qname)
[lookup_namespace(prefix, namespaces), local_name]
end
|
Instance Method Details
#from_xml(node) ⇒ Object
10
11
12
|
# File 'lib/saml2/base.rb', line 10
def from_xml(node)
self
end
|
#to_s ⇒ Object
14
15
16
17
|
# File 'lib/saml2/base.rb', line 14
def to_s
to_xml.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)
end
|
#to_xml ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/saml2/base.rb', line 19
def to_xml
unless @document
builder = Nokogiri::XML::Builder.new
build(builder)
@document = builder.doc
end
@document
end
|