Class: EndpointSecurity::FieldArray

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/endpoint_security/object_model.rb

Overview

Lazily loaded native array field.

Direct Known Subclasses

ExecArgs

Instance Method Summary collapse

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.

Yield Returns:

  • (Array) —

    copied field values



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.

Returns:

  • (Object, nil) —

    value at index



60
# File 'lib/endpoint_security/object_model.rb', line 60

def [](index) = values[index]

#each ⇒ Enumerator, FieldArray

Iterates over field values.

Returns:



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.

Returns:

  • (Integer) —

    number of values



63
# File 'lib/endpoint_security/object_model.rb', line 63

def length = values.length

#to_a ⇒ Array

Returns copied values.

Returns:

  • (Array) —

    copied values



67
# File 'lib/endpoint_security/object_model.rb', line 67

def to_a = values.dup