Method: Concurrent::IVar#try_set
- Defined in:
- lib/concurrent/ivar.rb
#try_set(value = NULL) { ... } ⇒ Boolean
Attempt to set the ‘IVar` with the given value or block. Return a boolean indicating the success or failure of the set operation.
144 145 146 147 148 149 |
# File 'lib/concurrent/ivar.rb', line 144 def try_set(value = NULL, &block) set(value, &block) true rescue MultipleAssignmentError false end |