Sha256: ae55bd712224bf6865da5f664aa1df646068ec9d53e4356f68850684ab392a31

Contents?: true

Size: 478 Bytes

Versions: 2

Compression:

Stored size: 478 Bytes

Contents

#          Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the MIT license.

# Extensions for Thread
class Thread
  # Copy all thread variables into the new thread
  def self.into(*args)
    Thread.new(Thread.current, *args) do |thread, *thread_args|
      thread.keys.each do |k|
        Thread.current[k] = thread[k] unless k.to_s =~ /^__/
      end

      yield(*thread_args)
    end
  end
end # Thread

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ramaze-2012.04.14 lib/ramaze/snippets/thread/into.rb
ramaze-2012.03.07 lib/ramaze/snippets/thread/into.rb