Class: Farce::Strict::TreeMap

Inherits:
Abstract::TreeMap show all
Includes:
Farce::Shareable::Delegated
Defined in:
lib/farce/strict/tree_map.rb

Overview

A Ractor-shareable map that keeps shareable entries sorted by key. Mutable string keys become immutable. Other keys and all values must already be Ractor-shareable.

Examples:

Keeping direct values in key order

map = Farce::Strict::TreeMap.new(2 => "two".freeze, 1 => "one".freeze)

map.to_a # => [[1, "one"], [2, "two"]]

Instance Method Summary collapse

Methods included from Farce::Shareable

#initialize, #ractor_shareable?

Methods inherited from Abstract::TreeMap

#[], #[]=, #clear, #compare_keys_by_identity?, #compare_values_by_identity?, #delete, #each, #each_key, #each_value, #empty?, #fetch, #first_key, #getkey, #initialize, #key?, #keys, #last_key, #length, #pop, #shareable_keys?, #shift, #size, #store_if_absent, #values

Methods included from Abstract::DuplicableMap

#compact, #compact_blank, #deep_dup, #duplicable?, #except, #flatten, #invert, #merge, #reject, #reverse_merge, #select, #slice, #stringify_keys, #symbolize_keys, #to_proc, #transform_keys, #transform_values, #with_indifferent_access

Methods inherited from Abstract::Map

#[], #[]=, #as_extended_json, #as_json, #assert_valid_keys, #assoc, #bson_type, #clear, #compare_by_identity?, #compare_keys_by_identity?, #compare_values_by_identity?, #deconstruct_keys, #delete, #dig, #each, #each_key, #each_pair, #each_value, #empty?, #fetch, #fetch_values, #getkey, #has_key?, #key, #key?, #keys, #length, #rassoc, #shareable_keys?, #size, #store, #store_if_absent, #to_a, #to_bson, #to_bson_normalized_value, #to_cbor, #to_h, #to_hash, #to_json, #to_msgpack, #to_query, #to_s, #value?, #values_at, #weak_keys?, #weak_values?

Instance Method Details

#shareable_values? ⇒ true

Values must already be Ractor-shareable.

Returns:

  • (true)


19
# File 'lib/farce/strict/tree_map.rb', line 19

def shareable_values? = true