123456789_123456789_123456789_123456789_123456789_

Module: Concurrent::Synchronization::Volatile::ClassMethods

Relationships & Source Files
Defined in: lib/concurrent-ruby/concurrent/synchronization/volatile.rb

Instance Method Summary

Instance Method Details

#attr_volatile(*names)

See additional method definition at line 39.

See additional method definition at line 56.

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/synchronization/volatile.rb', line 77

def attr_volatile(*names)
  names.each do |name|
    ivar = :"@volatile_#{name}"
    class_eval <<-RUBY, __FILE__, __LINE__ + 1
      def #{name}
        #{ivar}
      end

      def #{name}=(value)
        #{ivar} = value
      end
    RUBY
  end
  names.map { |n| [n, :"#{n}="] }.flatten
end