Class: SAML2::IndexedObject::Array
- Inherits:
-
Array
- Object
- Array
- SAML2::IndexedObject::Array
- Defined in:
- lib/saml2/indexed_object.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
Class Method Summary collapse
Instance Method Summary collapse
- #<<(value) ⇒ Object
- #[](index) ⇒ Object
-
#initialize(objects = nil) ⇒ Array
constructor
A new instance of Array.
- #resolve(index) ⇒ Object
Constructor Details
#initialize(objects = nil) ⇒ Array
Returns a new instance of Array.
39 40 41 42 |
# File 'lib/saml2/indexed_object.rb', line 39 def initialize(objects = nil) replace(objects.sort_by { |object| object.index || 0 }) if objects re_index end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
33 34 35 |
# File 'lib/saml2/indexed_object.rb', line 33 def default @default end |
Class Method Details
.from_xml(nodes) ⇒ Object
35 36 37 |
# File 'lib/saml2/indexed_object.rb', line 35 def self.from_xml(nodes) new(nodes.map { |node| name.split('::')[1..-2].inject(SAML2) { |mod, klass| mod.const_get(klass) }.from_xml(node) }).freeze end |
Instance Method Details
#<<(value) ⇒ Object
52 53 54 55 |
# File 'lib/saml2/indexed_object.rb', line 52 def <<(value) super re_index end |
#[](index) ⇒ Object
44 45 46 |
# File 'lib/saml2/indexed_object.rb', line 44 def [](index) @index[index] end |
#resolve(index) ⇒ Object
48 49 50 |
# File 'lib/saml2/indexed_object.rb', line 48 def resolve(index) index ? self[index] : default end |