Class: Thread

Inherits:
Object show all
Defined in:
lib/ramaze/snippets/thread/into.rb

Overview

Copyright © 2008 Michael Fellinger [email protected] All files in this distribution are subject to the terms of the Ruby license.

Class Method Summary collapse

Class Method Details

.into(*args) ⇒ Object

Copy following:

:action, :response, :request, :session,
:task, :adapter, :controller, :exception


9
10
11
12
13
14
15
16
17
# File 'lib/ramaze/snippets/thread/into.rb', line 9

def self.into *args
  Thread.new(Thread.current, *args) do |thread, *args|
    thread.keys.each do |k|
      Thread.current[k] = thread[k] unless k.to_s =~ /^__/
    end

    yield(*args)
  end
end