Module: SAML2::IndexedObject

Included in:
AttributeConsumingService, Endpoint::Indexed
Defined in:
lib/saml2/indexed_object.rb

Defined Under Namespace

Classes: Array

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#indexInteger

Returns:

  • (Integer)


8
9
10
# File 'lib/saml2/indexed_object.rb', line 8

def index
  @index
end

Class Method Details

.included(klass) ⇒ Object



91
92
93
# File 'lib/saml2/indexed_object.rb', line 91

def self.included(klass)
  klass.const_set(:Array, Array.dup)
end

Instance Method Details

#build(builder) ⇒ void

This method returns an undefined value.

Serialize this object to XML, as part of a larger document

Parameters:

  • builder (Nokogiri::XML::Builder)

    The builder helper object to serialize to.



85
86
87
88
89
# File 'lib/saml2/indexed_object.rb', line 85

def build(builder, *)
  super
  builder.parent.children.last["index"] = index
  builder.parent.children.last["isDefault"] = default? if default_defined?
end

#default?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/saml2/indexed_object.rb', line 21

def default?
  !!@is_default
end

#default_defined?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/saml2/indexed_object.rb', line 25

def default_defined?
  !@is_default.nil?
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
# File 'lib/saml2/indexed_object.rb', line 15

def eql?(other)
  index == other.index &&
    default? == other.default? &&
    super
end

#from_xml(node) ⇒ void

This method returns an undefined value.

Parse an XML element into this object.

Parameters:

  • node (Nokogiri::XML::Element)


30
31
32
33
34
# File 'lib/saml2/indexed_object.rb', line 30

def from_xml(node)
  @index = node["index"]&.to_i
  @is_default = node["isDefault"] && node["isDefault"] == "true"
  super
end

#initializeObject



10
11
12
13
# File 'lib/saml2/indexed_object.rb', line 10

def initialize(*)
  @is_default = nil
  super
end