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
9
10
|
# File 'lib/saml2/base.rb', line 5
def self.from_xml(node)
return nil unless node
result = new
result.from_xml(node)
result
end
|
.load_object_array(node, element, klass) ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/saml2/base.rb', line 35
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
29
30
31
32
33
|
# File 'lib/saml2/base.rb', line 29
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
45
46
47
48
|
# File 'lib/saml2/base.rb', line 45
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
12
13
|
# File 'lib/saml2/base.rb', line 12
def from_xml(_node)
end
|
#to_s ⇒ Object
15
16
17
18
|
# File 'lib/saml2/base.rb', line 15
def to_s
to_xml.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)
end
|
#to_xml ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/saml2/base.rb', line 20
def to_xml
unless instance_variable_defined?(:@document)
builder = Nokogiri::XML::Builder.new
build(builder)
@document = builder.doc
end
@document
end
|