class Persistent💎::Hash

Public Instance Methods

<(other) click to toggle source
# File lib/persistent_dmnd/hash.rb, line 82
def <(other)
  if size >= other.size
    false
  else
    self <= other
  end
end
<=(other) click to toggle source
# File lib/persistent_dmnd/hash.rb, line 90
def <=(other)
  if size > other.size
    false
  else
    each do |key, value|
      return false if other[key] != value
    end

    true
  end
end
eachDmnd()
Alias for: each💎
each💎() { |a💎[*pair]| ... } click to toggle source

Return each entry as a key, value pair inside an immutable array

# File lib/persistent_dmnd/hash.rb, line 103
def each💎
  if block_given?
    each { |pair| yield a💎[*pair] }
  else
    enum_for(:each💎)
  end
end
Also aliased as: eachDmnd
to_aDmnd()
Alias for: to_a💎
to_a💎() click to toggle source
# File lib/persistent_dmnd/hash.rb, line 113
def to_a💎
  a💎[*each💎]
end
Also aliased as: to_aDmnd
to_concurrent()
Alias for: to_concurrent_hash
to_concurrent_hash() click to toggle source

Return Concurrent::Hash with contents of Persistent💎::Hash

@example

my_hash = h💎[hello: :world]
my_concurrent_hash = my_hash.to_concurrent_hash
# File lib/persistent_dmnd/hash.rb, line 57
def to_concurrent_hash
  ConcurrentRubySupport::ensure_concurrent_ruby_loaded
  Concurrent::Hash[self]
end
Also aliased as: to_concurrent
to_concurrent_map() click to toggle source

Return Concurrent::Map with contents of Persistent💎::Hash

@example

my_hash = h💎[hello: :world]
my_concurrent_map = my_hash.to_concurrent_map
# => #<Concurrent::Map:0x0055ad9b283ea0 entries=1 default_proc=nil>
# File lib/persistent_dmnd/hash.rb, line 71
def to_concurrent_map
  ConcurrentRubySupport::ensure_concurrent_ruby_loaded
  each_with_object(Concurrent::Map.new(initial_capacity: size)) do |(key, value), result|
    result[key] = value
  end
end
to_hDmnd()
Alias for: to_h💎
to_h💎() click to toggle source
# File lib/persistent_dmnd/hash.rb, line 119
def to_h💎
  self
end
Also aliased as: to_hDmnd
to_sDmnd()
Alias for: to_s💎
to_set() click to toggle source
# File lib/persistent_dmnd/hash.rb, line 78
def to_set
  ::Set.new(self)
end
to_s💎() click to toggle source
# File lib/persistent_dmnd/hash.rb, line 125
def to_s💎
  s💎[*each💎]
end
Also aliased as: to_sDmnd