Class: SmartCore::Engine::Atom
- Inherits:
-
Object
- Object
- SmartCore::Engine::Atom
- Defined in:
- lib/smart_core/engine/atom.rb
Overview
Instance Method Summary collapse
- #initialize(initial_value = nil) ⇒ void constructor private
- #swap(&block) ⇒ Any
- #value ⇒ Any
Constructor Details
#initialize(initial_value = nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 14 |
# File 'lib/smart_core/engine/atom.rb', line 11 def initialize(initial_value = nil) @value = initial_value @barrier = SmartCore::Engine::Lock.new end |
Instance Method Details
#swap(&block) ⇒ Any
29 30 31 |
# File 'lib/smart_core/engine/atom.rb', line 29 def swap(&block) { @value = yield(@value) } end |
#value ⇒ Any
20 21 22 |
# File 'lib/smart_core/engine/atom.rb', line 20 def value { @value } end |