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



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

def index
  @index
end

Class Method Details

.included(klass) ⇒ Object



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

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



87
88
89
90
91
# File 'lib/saml2/indexed_object.rb', line 87

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

#default?Boolean



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

def default?
  !!@is_default
end

#default_defined?Boolean



29
30
31
# File 'lib/saml2/indexed_object.rb', line 29

def default_defined?
  !@is_default.nil?
end

#eql?(other) ⇒ Boolean



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

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.



34
35
36
37
38
# File 'lib/saml2/indexed_object.rb', line 34

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

#initializeObject



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

def initialize(*)
  @is_default = nil
  super
end