Sha256: fa039e050f368f81492b9ab05b379f17908200d95a3fe078c9978e2bb343ebd4
Contents?: true
Size: 705 Bytes
Versions: 11
Compression:
Stored size: 705 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 exit rescue => 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
11 entries across 11 versions & 1 rubygems