Class: EndpointSecurity::FieldArray
- Inherits:
-
Object
- Object
- EndpointSecurity::FieldArray
- Includes:
- Enumerable
- Defined in:
- lib/endpoint_security/object_model.rb
Overview
Lazily loaded native array field.
Direct Known Subclasses
Instance Method Summary collapse
-
#[](index) ⇒ Object?
Value at
index. -
#each ⇒ Enumerator, FieldArray
Iterates over field values.
-
#initialize(&loader) ⇒ FieldArray
constructor
private
A new instance of FieldArray.
-
#length ⇒ Integer
(also: #size)
Number of values.
-
#to_a ⇒ Array
Copied values.
Constructor Details
#initialize(&loader) ⇒ FieldArray
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of FieldArray.
46 47 48 |
# File 'lib/endpoint_security/object_model.rb', line 46 def initialize(&loader) @loader = loader end |
Instance Method Details
#[](index) ⇒ Object?
Returns value at index.
60 |
# File 'lib/endpoint_security/object_model.rb', line 60 def [](index) = values[index] |
#each ⇒ Enumerator, FieldArray
Iterates over field values.
52 53 54 55 56 57 |
# File 'lib/endpoint_security/object_model.rb', line 52 def each(&) return enum_for(__method__) unless block_given? values.each(&) self end |
#length ⇒ Integer Also known as: size
Returns number of values.
63 |
# File 'lib/endpoint_security/object_model.rb', line 63 def length = values.length |
#to_a ⇒ Array
Returns copied values.
67 |
# File 'lib/endpoint_security/object_model.rb', line 67 def to_a = values.dup |