Class: Farce::Unshared::Atom
- Inherits:
-
Abstract::Atom
- Object
- Abstract::Atom
- Farce::Unshared::Atom
- Includes:
- Farce::Unshareable
- Defined in:
- lib/farce/unshared/atom.rb
Overview
A thread-safe atomic reference that retains values directly within one Ractor. Mutable values keep their identity. Updates are serialized between threads.
Instance Method Summary collapse
-
#initialize(value = nil, compare_by_identity: false) ⇒ Atom
constructor
A new instance of Atom.
Methods included from Farce::Unshareable
Methods inherited from Abstract::Atom
#blank?, #compare_and_set, #compare_by_identity?, #get, #store, #store_if_absent, #swap, #update, #upsert, #value, #value=, #wait_until, #wait_until_changed, #wait_until_match, #wait_until_non_nil, #wait_until_value, #wait_while, #wait_while_match, #wait_while_value
Methods included from Internal::ValueSerialization
#as_extended_json, #as_json, #to_bson, #to_bson_normalized_value, #to_cbor, #to_json, #to_msgpack
Methods included from Abstract::Value
Methods included from Internal::Copyable
Constructor Details
#initialize(value = nil, compare_by_identity: false) ⇒ Atom
Returns a new instance of Atom.
18 19 20 21 |
# File 'lib/farce/unshared/atom.rb', line 18 def initialize(value = nil, compare_by_identity: false) @atom = Internal::UnsharedAtom.new(value, compare_by_identity:) super() end |