class SparseArray

Public Instance Methods

length() click to toggle source
# File lib/exonum/util/sparse_array.rb, line 2
def length
  if keys.any?
    keys.max + 1
  else
    0
  end
end
serialize() click to toggle source
# File lib/exonum/util/sparse_array.rb, line 10
def serialize
  if keys.any?
    (0..(length-1)).map {|i| fetch i, 0 }
  else
    []
  end
end