Module: ActiveTools::CoreExtension::RuntimeCaching

Defined in:
lib/active_tools/core_extension/runtime_caching.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_runtime_caching(*args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/active_tools/core_extension/runtime_caching.rb', line 4

def acts_as_runtime_caching(*args)
  options = args.extract_options!
  args.each do |method|
    instance_eval <<-DELEGATORS
      def #{method}
        ::Thread.current[:#{method}]
      end

      def #{method}=(value)
        ::Thread.current[:#{method}] = (value)
      end
    DELEGATORS
  end
end