Atomic reference implementation for Ruby