Class: Saml::Kit::AttributeStatement
- Inherits:
-
Object
- Object
- Saml::Kit::AttributeStatement
- Includes:
- XmlParseable
- Defined in:
- lib/saml/kit/attribute_statement.rb
Constant Summary
Constants included from XmlParseable
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(node) ⇒ AttributeStatement
constructor
A new instance of AttributeStatement.
Methods included from XmlParseable
#present?, #to_h, #to_s, #to_xhtml, #to_xml
Constructor Details
#initialize(node) ⇒ AttributeStatement
Returns a new instance of AttributeStatement.
10 11 12 13 |
# File 'lib/saml/kit/attribute_statement.rb', line 10 def initialize(node) @to_nokogiri = node @content = node.to_s end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
8 9 10 |
# File 'lib/saml/kit/attribute_statement.rb', line 8 def content @content end |
Instance Method Details
#attributes ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/saml/kit/attribute_statement.rb', line 15 def attributes @attributes ||= search('./saml:Attribute').inject({}) do |memo, item| namespace = Saml::Kit::Document::NAMESPACES values = item.search('./saml:AttributeValue', namespace) memo[item.attribute('Name').value] = values.length == 1 ? values[0].try(:text) : values.map { |x| x.try(:text) } memo end.with_indifferent_access end |