Sha256: 5a331f7ee5de9900a9545010055fb89906ff2ab3f42d2983c771c8932e1dc026
Contents?: true
Size: 914 Bytes
Versions: 1
Compression:
Stored size: 914 Bytes
Contents
# ThreadLocalAccessor Thread local accessor. An idea and big part of code from [here](http://coderrr.wordpress.com/2008/04/10/lets-stop-polluting-the-threadcurrent-hash/). ## Installation Add this line to your application's Gemfile: gem 'thread_local_accessor' And then execute: $ bundle Or install it yourself as: $ gem install thread_local_accessor ## Usage It implement thread-safe class accessor implemented via Thread.current: ``` ruby class ThreadedLib thread_local_accessor :some_setting, :default => :default end instance = ThreadedLib.new ThreadedLib.some_setting = 5 ThreadedLib.some_setting # => 5 instance.some_setting # => 5 Thread.new { ThreadedLib.some_setting # => :default instance.some_setting # => :default end ``` ## Status [<img src="https://secure.travis-ci.org/avakhov/thread_local_accessor.png"/>](http://travis-ci.org/avakhov/thread_local_accessor)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
thread_local_accessor-0.1.1 | README.md |