Method: Cond::ThreadLocal.accessor_module
- Defined in:
- lib/cond/thread_local.rb
.accessor_module(name, subclass = self, &block) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/cond/thread_local.rb', line 51 def accessor_module(name, subclass = self, &block) var = subclass.new(&block) Module.new { define_method(name) { var.value } define_method("#{name}=") { |value| var.value = value } } end |