Sha256: 458faa31bc37cb71f5ee83af1c3c2bc17f1f931d61e17e624b8fe13bdb40b2ac
Contents?: true
Size: 727 Bytes
Versions: 57
Compression:
Stored size: 727 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 #Initializes the thread and passes any given arguments to the thread-block. def initialize(*args) raise "No block was given." unless block_given? super(*args) do begin yield(*args) rescue SystemExit, Interrupt raise rescue Exception => e print "#{Knj::Errors.error_str(e)}\n\n" end end @data = {} end #Returns a key from the data-hash. def [](key) return @data[key] end #Sets a key on the data-hash. def []=(key, value) return @data[key] = value end end
Version data entries
57 entries across 57 versions & 1 rubygems