Sha256: 3cfb8897a50fcfdb1cdd4e9f126468b9c8c57afdddbc50d7a21ef4ef04660f19

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

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

class Thread
  # Copy following:
  #   :action, :response, :request, :session,
  #   :task, :adapter, :controller, :exception

  def self.into
    Thread.new(Thread.current) do |thread|
      current = Thread.current

      vars = Dir["#{Ramaze::BASEDIR}/**/*.rb"].
        map{|f| File.readlines(f).
          map{|l| l[/Thread\.current\[:([^\]]*)\]/, 1] } }

      vars.flatten.compact.uniq.each do |var|
        var = var.to_sym
        current[var] = thread[var]
      end

      yield
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ramaze-0.2.0 lib/ramaze/snippets/thread/into.rb