Sha256: c1157b5530eeb74409ef30d29bba4dd30cee40159afe81758898aee1669ea111

Contents?: true

Size: 548 Bytes

Versions: 1

Compression:

Stored size: 548 Bytes

Contents

#This class behaves like a normal thread - but it shows error-messages and tracebacks. Normal threads dont do that.
class Knj::Thread < Thread
	attr_accessor :data
	
	def initialize(*args, &block)
		@data = {}
		raise "No block was given." if !block_given?
		
		abort_on_exception = true
		super(*args) do
			begin
				block.call(*args)
			rescue SystemExit
				exit
			rescue Exception => e
        print Knj::Errors.error_str(e)
			end
		end
	end
	
	def [](key)
		return @data[key]
	end
	
	def []=(key, value)
		return @data[key] = value
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
knjrbfw-0.0.8 lib/knj/thread.rb