Method: Weak::Map::WeakKeys#keys

Defined in:
lib/weak/map/weak_keys.rb

#keysArray

Note:

In contrast to a Hash, Weak::Maps do not necessarily retain insertion order.

Returns an Array containing all keys of the map for which we have a valid value. Keys with garbage-collected values are excluded.

Returns:

  • (Array)

    an Array containing all keys of the map for which we have a valid value. Keys with garbage-collected values are excluded.

See Also:



111
112
113
# File 'lib/weak/map/weak_keys.rb', line 111

def keys
  @map.keys.delete_if { |key| missing?(@map[key]) }
end