Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/esm/extension/core/array.rb

Instance Method Summary collapse

Instance Method Details

#to_arma_hashmapObject



4
5
6
# File 'lib/esm/extension/core/array.rb', line 4

def to_arma_hashmap
  ESM::Arma::HashMap.from(self)
end

#total_sizeObject

Adds up all the sizes of every element inside the array



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/esm/extension/core/array.rb', line 9

def total_size
  reduce(0) do |total, i|
    size =
      case i
      when Array
        i.total_size
      when Integer
        i
      else
        i.size
      end

    total + size
  end
end