Sha256: 36b4fbe852061a85b7c7bb2403ddfe3ad5a52aa9b76fe454c6692041a758d2b5

Contents?: true

Size: 658 Bytes

Versions: 7

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

module Saml
  module Kit
    class AttributeStatement
      include XmlParseable

      attr_reader :content

      def initialize(node)
        @to_nokogiri = node
        @content = node.to_s
      end

      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
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
saml-kit-1.3.0 lib/saml/kit/attribute_statement.rb
saml-kit-1.2.0 lib/saml/kit/attribute_statement.rb
saml-kit-1.1.0 lib/saml/kit/attribute_statement.rb
saml-kit-1.0.31 lib/saml/kit/attribute_statement.rb
saml-kit-1.0.30 lib/saml/kit/attribute_statement.rb
saml-kit-1.0.29 lib/saml/kit/attribute_statement.rb
saml-kit-1.0.28 lib/saml/kit/attribute_statement.rb